Home > Metro, Windows 8 > Windows 8 Theme changing between dark and light

Windows 8 Theme changing between dark and light

The new UI Style Windows 8 apps support a dark and light theme, which cannot be changed during runtime.

The developer can set it either in code, which must be very early during startup like in the App ctor:

 

public App()
{
    Application.Current.RequestedTheme = ApplicationTheme.Light; 
    this.InitializeComponent();
    //..
}

 

or directly in App.xaml like this:

 

<Application
x:Class="AppBarDemo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppBarDemo"
xmlns:localData="using:AppBarDemo.Data"
RequestedTheme="Light">

 

The Visual Studio designer preview also supports themes. They can be set in the Devices toolbar:

image

 

If there should be other values used for the different color settings, then you can add this settings to StandardStyles.xaml

<SolidColorBrush x:Key="ApplicationPageBackgroundThemeBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="ApplicationForegroundThemeBrush" Color="#333333"/>
<SolidColorBrush x:Key="ApplicationSecondaryForegroundThemeBrush" Color="#FF991100"/>
<SolidColorBrush x:Key="ApplicationPointerOverForegroundThemeBrush" Color="#AAAAAA"/>
<SolidColorBrush x:Key="BackButtonBackgroundThemeBrush" Color="#00000000"/>
<SolidColorBrush x:Key="BackButtonForegroundThemeBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="BackButtonPressedBackgroundThemeBrush" Color="#00000000"/>
<SolidColorBrush x:Key="BackButtonPressedForegroundThemeBrush" Color="#CCCCCC"/>
<SolidColorBrush x:Key="BackButtonPointerOverBackgroundThemeBrush" Color="#00000000"/>

 

 .

Categories: Metro, Windows 8
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: