Determine Light or Dark Theme in WP7

When you create WP7 applications it is important that you test your application using both Light and Dark theme, and also try it with different accent colors. If you are unlucky your application could be rejected if you have not tested it with the light theme.

In my recent WP7 application I wanted to change the panorama background image depending on light or dark theme. So how do I do that? Well it is actually pretty simple to find out what theme is currently used. By using the static resources PhoneLightThemeVisibility I can figure out if the Light theme is currently beeing used.

            Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];
            if (v == System.Windows.Visibility.Visible)
            { . . . }

A pretty nice way of finding out what theme is beeing used.

  1. No trackbacks yet.

Leave a Reply

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

You are commenting using your 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: