-
对话框
private async void myButton_Click(object sender, RoutedEventArgs e)
{
ContentDialog noWifiDialog = new ContentDialog
{
Title = "No wifi connection",
Content = "Check your connection and try again.",
CloseButtonText = "OK"
};
//必须设置XamlRoot,否则会报错误:Value does not fall within the expected range.
noWifiDialog.XamlRoot = this.Content.XamlRoot;
ContentDialogResult result = await noWifiDialog.ShowAsync();
if (result == ContentDialogResult.Primary)
{
mybtn.Content = "clicked.";
}
}