I have a Windows 8.1 WinRT app. I want to have a XAML control in which i can have xaml controls like a button, textblock, listbox, etc.
I want to be able to load this XAML control in any page from the app. But i want it to appear as a modal, on top of the current page over a black overlay.
How can i load a Xaml control on top of the current page? Is there a way ot interact from this overlay with the other controls in the current page?
Example: while on a page, i want to open the modal and tap a button which will fill a form in the current page with test data.
You can host your controls in a ContentDialog . Visual Studio has a ContentDialog template which you can use to create the dialog like you would a UserControl. You can then launch it modally on top of any page:
private async void Button_Click(object sender, RoutedEventArgs e)
{
ContentDialog1 cd = new ContentDialog1();
cd.TestData = "Lorem ipsum";
await cd.ShowAsync();
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.