tao*_*tao 10 c# xaml windows-10 uwp
当我在Windows 10中使用Mail univesal应用程序时,当我添加一个帐户(设置 - >帐户 - >添加帐户)时,似乎弹出一个模式窗口来选择一个帐户.我尝试使用MessageDialog,但我不能将任何自定义内容放入其中.
有人知道如何实现它或有一些api可以做到吗?
注意:当此窗口打开时,您甚至无法最小化/最大化/关闭主窗口.所以,它绝对是一个模态窗口.
Lie*_*ero 18
我还没有用过它,但我相信你正在寻找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();
Run Code Online (Sandbox Code Playgroud)

对话框的msdn指南:链接
msdn ContentDialog API: 链接
您可以轻松地创建这样的新视图,例如在您的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;
}
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请查看这两个指南:
| 归档时间: |
|
| 查看次数: |
16028 次 |
| 最近记录: |