我正在使用 VS2015 开发 UWP Win10 应用程序。我正在使用 ContenDialog 来显示模态窗口/弹出窗口。我需要更改 ContentDialog 的背景叠加颜色。这该怎么做。即使在内部样式中也没有选项/属性。
我需要将覆盖白色暗淡颜色更改为其他颜色,如黑色覆盖/暗淡颜色等......
见图片。
我正在使用 VS2015 开发 UWP Win10 应用程序。我正在使用 ContenDialog 来显示模态窗口/弹出窗口。我需要更改 ContentDialog 的背景叠加颜色。这该怎么做。即使在内部样式中也没有选项/属性。
我需要将覆盖白色暗淡颜色更改为其他颜色,如黑色覆盖/暗淡颜色等......
见图片。
要设置的关键资源是SystemControlPageBackgroundMediumAltMediumBrush
我使用以下主题定义来定位我的应用程序中的所有 ContentDialogs:
<!-- override the Dialog Background -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<SolidColorBrush x:Key="ContentDialogDimmingThemeBrush" Color="#99FFFFFF" />
<SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="#99000000" />
<StaticResource x:Key="ContentDialogLightDismissOverlayBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="ContentDialogDimmingThemeBrush" Color="{ThemeResource SystemColorHighlightColor}" />
<SolidColorBrush x:Key="SystemControlPageBackgroundMediumAltMediumBrush" Color="#99000000" />
<StaticResource x:Key="ContentDialogLightDismissOverlayBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
我认为您需要自定义使用控件才能更好地控制背景。默认ContenDialog
提供非常简单的设置,并且对按钮/内容的数量有限制。