As the Windows Phone 7 have either a dark (black) or light (white) theme which can be applied it will become very important for you to know which theme the user enabled in order to determine your applications color schema, this is assuming you are using styles which are not built into the skinning on WP7.
Sadly detecting the current theme is a bit hackish as it requires you to take a look at a current loaded resource to determine the theme. I would have hoped that this would be part of the built in SDK as I see this as a common need for many applications.
Here is how you determine which theme is being used.
Color themeColor = (Color)Application.Current.Resources["PhoneForegroundColor"];
if (themeColor.ToString() == "#FFFFFFFF")
{
this.PageTitle.Text = "Dark ";
}
else if (themeColor.ToString() == "#DE000000")
{
this.PageTitle.Text = "Light ";
}
As you can see the code to determine the theme is easy, but not clean in my opinion.
Till next time,
Posted
07-27-2010 5:07 AM
by
Derik Whittaker