Many time we need to find out which Theme we are using in Windows Phone 7. Based upon the chosen theme we may want to set our own Theme for the application. So, how to find out that?

 

In this post, I am going to share you the Tip. Using it you will be able to identify the current theme of your Windows Phone 7 device. Read to know more.

 

There are two different types of theme presently available in Windows Phone 7 called as "Dark Theme" and "Light Theme". Detecting the current theme is easy. There is a "PhoneLightThemeVisibility" resource available in the application level. If it is set to Visible, that means that you are using the Light Theme and if it is set to Collapsed, that means you are using the Dark Theme.

 

When you want to detect the current theme check the visibility status of the resource by retrieving it as below:

 
var v = (Visibility)Resources["PhoneLightThemeVisibility"];

 

Let's demonstrate it with a small demo app. In a Windows Phone 7 application project, open the MainPage.xaml.cs and in the constructor of the class, register the loaded event and inside the event implementation write the following code:

 
void MainPage_Loaded(object sender, RoutedEventArgs e)
{
    var v = (Visibility)Resources["PhoneLightThemeVisibility"];
    MessageBox.Show("You are using " + (v == Visibility.Visible ? "Light" : "Dark") + " Theme");
}

 

In any of the case, it will show the current theme that you are using in your phone. Let's see it in action.

 

WP7 Demo - Dark Theme          WP7 Demo - Light Theme

 

The first screenshot describes that you are using the dark theme. It will show you the message mentioning the dark theme. The second screenshot describes that you are using the light theme. Similar to the first theme, it mention the light theme in the message box. You can change the theme from the settings page of your phone device.

Have a question? Or, a comment? Let's Discuss it below...

Thank you for visiting our website!

We value your engagement and would love to hear your thoughts. Don't forget to leave a comment below to share your feedback, opinions, or questions.

We believe in fostering an interactive and inclusive community, and your comments play a crucial role in creating that environment.