如何更改 ContentDialog uwp 的背景覆盖
How to change background overlay of ContentDialog uwp
我正在使用 VS2015 开发 UWP Win10 应用程序。我正在使用 ContenDialog 来显示模态 Window / 弹出窗口。我需要更改 ContentDialog 的背景覆盖颜色。这该怎么做。即使在内部 Style 中也没有 option/property。
我需要将 Overlay White Dim 颜色更改为其他颜色,例如 Blackish overlay/dim 颜色等...
看图
我认为您需要自定义使用控件才能更好地控制背景。默认 ContenDialog
提供非常简单的骨架设置,并且对按钮/内容的数量有限制。
要设置的关键资源是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>
我正在使用 VS2015 开发 UWP Win10 应用程序。我正在使用 ContenDialog 来显示模态 Window / 弹出窗口。我需要更改 ContentDialog 的背景覆盖颜色。这该怎么做。即使在内部 Style 中也没有 option/property。
我需要将 Overlay White Dim 颜色更改为其他颜色,例如 Blackish overlay/dim 颜色等...
看图
我认为您需要自定义使用控件才能更好地控制背景。默认 ContenDialog
提供非常简单的骨架设置,并且对按钮/内容的数量有限制。
要设置的关键资源是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>