1
votes

I have a problem with themes on my Windows 10 Universal App. I'm testing it on phone. It works fine when I'm on light theme - Texts are black. But when I change theme to dark, the font stays dark and it cannot be seen.

I know I can manually programaticaly change font color to white when I'm on dark theme. But I doubt it is a proper way. How should I take care of white and black theme?

1

1 Answers

0
votes

You can use the {StaticResource} markup extension

<RelativePanel x:Name="MymusicSubPanel" Background="{ThemeResource SystemControlTranslucentHighBrush}" ... >
      ...
</RelativePanel>

And you can use different color to your Theme.

<SolidColorBrush x:Key="SystemBackgroundAltHighBrush" Color="#FFF0F0F0"/>

How to use the Theme?You can use it in the Page resources.

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary Source="LightThemeDictionary.xaml" x:Key="Light"/>
            <ResourceDictionary Source="DarkThemeDictionary.xaml" x:Key="Dark"/>
            <ResourceDictionary Source="HighContrastBlackDictionary.xaml" x:Key="HighContrastBlack"/>

            ...

        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Page.Resources>

You can use the Theme,you write the back is black and text foreground color is white.

https://embracez.xyz/xaml-uwp-themes/