Determine Current Theme

Posted: October 30, 2011 in Windows Phone 7 & Mango

When creating a windows phone application, it is important that it works with both Light and Dark themes! If your application does not work on both themes, it will fail submission into the marketplace. To check the current theme, you can do the following:

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

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s