acedened
acedened

Reputation: 81

Change default dark background in UWP

I'm trying to change default black background to #111. Here is the code that i tried to use

    <ResourceDictionary x:Key="Dark">

        ...

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

    </ResourceDictionary>

But it doesn't work. What i'm doing wrong?

Upvotes: 3

Views: 4765

Answers (1)

Bart
Bart

Reputation: 10015

SystemAltHighColorBrush is not a used brush in Windows 10 UWP. You can double check all used resources at the following path:

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

If you mean the application's page background, you're looking for ApplicationPageBackgroundThemeBrush as this is the default style used on each new page.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

You're trying to change theme resources (they differ between dark and light), so your change should reflect this. Override the theme dictionaries with the appropriate keys. As #111111 is very close to black, I took a fancy green for demo purposes.

<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>

Upvotes: 9

Related Questions