When I use Mail univesal app in windows 10, when i add an account (setting->accounts->add account), it seems popup a modal window to choose an account. I try to use MessageDialog, but i can't put any custom content into it.
EDIT : this is the screenshot
Is someone knows how to implement it or there is some api can do it?
Note: When this window open, you even can't Minimize/Maximize/Close the main Window. So, it is definitely a modal window.
I haven't used it myself yet but i believe you're looking for ContentDialog api.
var dialog = new ContentDialog() {
Title = "Lorem Ipsum",
MaxWidth = this.ActualWidth // Required for Mobile!
Content = YourXamlContent
};
dialog.PrimaryButtonText = "OK";
dialog.IsPrimaryButtonEnabled = false;
dialog.PrimaryButtonClick += delegate {
};
var result = await dialog.ShowAsync();
msdn guidlines for dialogs: link
msdn ContentDialog API: link
You can easily create a new view like this, for example in your App.xaml.cs
:
public static async Task<bool> TryShowNewWindow<TView>(bool switchToView)
{
var newView = CoreApplication.CreateNewView();
int newViewId = 0;
await newView.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
var frame = new Frame();
frame.Navigate(typeof(TView), null);
Window.Current.Content = frame;
newViewId = ApplicationView.GetForCurrentView().Id;
});
var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId);
if (switchToView && viewShown)
{
// Switch to new view
await ApplicationViewSwitcher.SwitchAsync(newViewId);
}
return viewShown;
}
For further information, take a look at those two guides:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With