Saturday, March 12, 2011

Forcing the Aero Theme in your application

I have yet to find a theme that I am as satisfied with in WPF as the default aero theme that comes with the framework. But if you do not apply a theme to your application the look and feel of the WPF application will change according to the look and feel setup by the client.

But if you want your WPF application to always use the aero theme irrespective of the current client computer theme setting you can do that in simple steps.

Add a reference to PresentationFramework.Aero :
And set its property "CopyLocal" to true:

Finally add the following to your app.xaml:


<Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>                
                <ResourceDictionary Source="/PresentationFramework.Aero;component\themes/aero.normalcolor.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>


And now your application will use the aero theme irrespective of client settings.