更改UWP中的默认深色背景

ace*_*ned 3 xaml uwp

我正在尝试将默认黑色背景更改为#111.这是我试图使用的代码

    <ResourceDictionary x:Key="Dark">

        ...

        <Color x:Key="SystemAltHighColor">#111</Color>
        <SolidColorBrush x:Key="SystemAltHighColorBrush" Color="{StaticResource SystemAltHighColor}"/>
        ...

    </ResourceDictionary>
Run Code Online (Sandbox Code Playgroud)

但它不起作用.我做错了什么?

Bar*_*art 8

SystemAltHighColorBrush在Windows 10 UWP中不是使用过的画笔.您可以在以下路径中仔细检查所有已使用的资源:

C:\ Program Files(x86)\ Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.10240.0\Generic\generic.xaml

如果您的意思是应用程序的页面背景,那么您正在寻找,ApplicationPageBackgroundThemeBrush因为这是每个新页面上使用的默认样式.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Run Code Online (Sandbox Code Playgroud)

您正在尝试更改主题资源(它们在黑暗和光明之间有所不同),因此您的更改应该反映这一点.使用适当的键覆盖主题词典.由于#111111非常接近黑色,我花了一个花哨的绿色用于演示目的.

<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
                <Color x:Key="SystemAltHighColor">#11CC11</Color>
                <SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="{ThemeResource SystemAltHighColor}" />
            </ResourceDictionary>
            <ResourceDictionary x:Key="Dark">
                <Color x:Key="SystemAltHighColor">#11CC11</Color>
                <SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="{ThemeResource SystemAltHighColor}" />
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)