Detecting the Windows Phone 7 Theme in c#

The Windows Phone 7 comes with two background color modes dark or light. Along with this ,there are ten accent colors that can be selected from .

The colors that you select here will show up in different places of the phone like the Tiles pinned in the Start Screen , Application List etc..

The easiest way to identify the Theme and the accent color that the user has choosen in the device can be found via the Application Resources that is used .

In the Development Environment , you can find the file ThemeResources.xaml in the path
C:\Program Files\Microsoft SDKs\Windows Phone\v7.0\Design

The background color of the Windows Phone 7 can be determined by

Color backgroundColor = (Color)Application.Current.Resources["PhoneBackgroundColor"];

The other Way to find if the Dark or Light Background is visible is again by using the Resources string PhoneLightThemeVisibility or PhoneDarkThemeVisibility which will give you information if visible or collapsed .

Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];
Visibility w = (Visibility)Resources["PhoneDarkThemeVisibility"];

The Accent Color can be accent colors can be determined with any of the following ways

SolidColorBrush x = (SolidColorBrush)Resources["PhoneAccentBrush"];
Color accentColor = (Color)Application.Current.Resources["PhoneAccentColor"];

You can find more information about Theme Resources in the MSDNResources for Windows Phone


If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Pin It

5 thoughts on “Detecting the Windows Phone 7 Theme in c#

  1. Pingback: Tweets that mention Detecting the Windows Phone 7 Theme in c# | Senthil Kumar's Blog --

  2. Hi guy, I learn alot out of your site. but can you elaborate more details here? cos I am a total newbie~ :p Cheers

  3. Pingback: Detecting the Windows Phone 7 Theme in c | ProgramInDotnet

  4. Hello, I am making an application but I want the color of the buttons is this white font for the black theme. I don’t want the bottoms to be changed when the user chooses the light theme. somehow I want to disconnect my application from the theme chosen, is there a way to do so ?

  5. Pingback: Interesting .NET Links - January 5 , 2010 | TechBlog

Leave a Reply

Your email address will not be published. Required fields are marked *