Enabling Windows Phone 7 Themes in Emulator Applications

I just noticed that Peter has put up a post on how to make a Windows Phone 7 application theme aware. I couldn’t help but recall one of the more obscure side comments in one of the MIX sessions where the presenter commented out a bunch of code in the App.xaml file in order to get theming to work correctly.  Anyhow, if you’re interested the section of xaml to comment out is the following:

        <!– Brush Resources –>
        <!–<SolidColorBrush x_Key="PhoneAccentBrush" Color="{StaticResource PhoneAccentColor}"/>
        <SolidColorBrush x_Key="PhoneBackgroundBrush" Color="{StaticResource PhoneBackgroundColor}"/>
        <SolidColorBrush x_Key="PhoneContrastForegroundBrush" Color="{StaticResource PhoneContrastForegroundColor}"/>
        <SolidColorBrush x_Key="PhoneForegroundBrush" Color="{StaticResource PhoneForegroundColor}"/>
        <SolidColorBrush x_Key="PhoneInactiveBrush" Color="{StaticResource PhoneInactiveColor}"/>
        <SolidColorBrush x_Key="PhoneDisabledBrush" Color="{StaticResource PhoneDisabledColor}"/>
        <SolidColorBrush x_Key="PhoneSubtleBrush" Color="{StaticResource PhoneSubtleColor}"/>
        <SolidColorBrush x_Key="PhoneContrastBackgroundBrush" Color="{StaticResource PhoneContrastBackgroundColor}"/>
        <SolidColorBrush x_Key="PhoneTextBoxBrush" Color="{StaticResource PhoneTextBoxColor}"/>
        <SolidColorBrush x_Key="PhoneBorderBrush" Color="{StaticResource PhoneBorderColor}"/>
        <SolidColorBrush x_Key="PhoneTextSelectionBrush" Color="{StaticResource PhoneTextSelectionColor}"/>
        <SolidColorBrush x_Key="TransparentBrush" Color="Transparent"/>—>

You should be aware that this effectively breaks the current design experience within Visual Studio and can even cause the IDE to crash.  I actually closed all my open documents before making this change and then un-commented the xaml once I was done testing the theme support.

Anyhow, here’s a (poorly designer) test application that shows the Light theme option:


Leave a comment