Monday, September 10, 2012

Windows 8: Setting the application theme

In Windows Phone you had a global Theme setting on your mobile phone which allows you to switch between the dark and light theme. One thing I didn’t like is that you had to use some tricks to detect the currently active Theme setting.

In Windows 8 Microsoft is taking a different approach: there’s no global theme setting, instead it’s up to the developer to decide if her application uses the dark or the light theme.

You can set the current theme by changing the RequestedTheme-attribute on the Application class. This can be done either through code or through XAML.

<Application x:Class="ThemeSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RequestedTheme="Light">

No comments: