2
votes

In Windows 8, you were able to create your own themes for your application (here's a tutorial).

In Windows 8.1 Applications, themes are handled differently: you can change them at run-time and set a theme for a specific control in your XAML (if you don't want to apply the theme to the whole Application).

For instance:

<Grid x:Name="MainGrid" RequestedTheme="Dark">

However, I could not find a way to create my own themes. The property RequestedTheme takes an enumeration (its type is FrameworkElement.RequestedTheme) and an enumeration by definition cannot be extended (in C#). Also, if I want to define a new Theme Dictionary I would have written:

<ResourceDictionary.ThemeDictionaries>

But it is not available in Windows 8.1.

How can one create a theme in Windows 8.1? Am I limited to the existing ones (light & dark)?

1
You don't create new themes, you override the 3 existing themes.WiredPrairie

1 Answers

3
votes

Yes you're restricted to 3 themes I believe

Default (light) Dark High Contrast

You can create new styles or override existing ones for the 3 themes like this in 8.1

 <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Default">
                <Style TargetType="TextBlock">
                    <Setter Property="FontSize" Value="24" />
                    <Setter Property="Foreground" Value="Green"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary x:Key="Dark">
                <Style TargetType="TextBlock">
                    <Setter Property="FontSize" Value="30" />
                    <Setter Property="Foreground" Value="Orange"/>
                </Style>
            </ResourceDictionary>
            <ResourceDictionary x:Key="HighContrast">
                <Style TargetType="TextBlock">
                    <Setter Property="FontSize" Value="24" />
                    <Setter Property="Foreground" Value="Blue"/>
                </Style>
            </ResourceDictionary>               
        </ResourceDictionary.ThemeDictionaries>