【发布时间】:2020-08-30 10:54:18
【问题描述】:
当ContentDialog 与Fluent XAML Theme Editor 的颜色主题一起使用时,内容对话框会覆盖整个页面
要复制,请按以下步骤操作:
- 创建新的 UWP 应用
- 从Fluent XAML Theme Editor 获取配色方案并将其添加到您的项目中
- 在 App.Xaml 中添加:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Dictionary1.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
- 将
TextBlock和Loaded事件添加到MainPage - 将
ContentDialog调用添加到Loaded事件
private async void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
ContentDialog noWifiDialog = new ContentDialog
{
Title = "No wifi connection",
Content = "Check your connection and try again.",
CloseButtonText = "Ok"
};
_ = await noWifiDialog.ShowAsync();
}
- 运行应用程序,看看
ContentDialog是如何掩盖TextBlock的。如果您移除颜色主题,则不会发生这种情况。
【问题讨论】: