在浏览下一页时,内容对话框应显示为没有按钮单击。
在浏览下一页时,内容对话框应显示为没有按钮单击。
导航到下一页时,它将触发OnNavigatedTo方法,您可以在其中显示内容对话框而无需单击按钮。
下一页.xaml.cs:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
DisplayNoWifiDialog();
}
private async void DisplayNoWifiDialog()
{
ContentDialog noWifiDialog = new ContentDialog()
{
Title = "Next Page",
Content = "Hello.",
CloseButtonText = "Ok"
};
await noWifiDialog.ShowAsync();
}
更新:
如果您的内容对话框使用xaml编写,则可以订阅Loaded事件并在其中显示对话框。
下一页.xaml:
<StackPanel>
<ContentDialog x:Name="MyContentDialog"
Title="Hello"
Content="Welcome"
CloseButtonText="Cancel">
</ContentDialog>
</StackPanel>
下一页.cs:
public BlankPage1()
{
this.InitializeComponent();
this.Loaded += BlankPage1_Loaded;
}
private async void BlankPage1_Loaded(object sender, RoutedEventArgs e)
{
await MyContentDialog.ShowAsync();
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句