Home  separator  Styling  separator  Themes
Bookmark and Share Share...    Subscribe to this feed Feed   About Christian Moser  

Themes in WPF


This article will follow soon...

How to use specific Windows theme in a WPF application

WPF includes all common Windows themes. By default WPF loads the current Windows theme as your default style-set. But you can override these styles by loading a specific theme. To do this you first have to add an reference to the style assembly you like to use and second you need to merge the theme resource dictionary into your app resources. This overrides the default style-set that has been loaded by WPF.

The following exmple shows how to load the Windows Vista Aero theme.

    <ResourceDictionary Source="/PresentationFramework.Aero, Version=,
           Culture=neutral, PublicKeyToken=31bf3856ad364e35,
           ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />

Last modified: 2009-05-08 01:20:21
Copyright (c) by Christian Moser, 2011.

 Comments on this article

Show all comments
Christian Moser
Commented on 4.November 2009
This error message can have multiple causes. Have a look at this MSDN article, it clearly explains all possible causes: http://msdn.microsoft.com/en-us/library/bb907310.aspx

Commented on 18.February 2010
worst \"article\" ever
Commented on 8.April 2010
Check this out http://wpfthemes.codeplex.com/
Commented on 19.April 2010
Hi, The error message maybe because you did not include "PresentationFramework.Aero" to your project reference
Commented on 19.May 2010
I have seen more crappy articles and more dysfunctional code snippets for Forms/WPF/Silverlight than there are grains of sand on your average beach. Here's yet another one. To the author: if you don't know what your doing (yo don't) how about you STFU?
Commented on 8.July 2010
Thanks.. good one
Commented on 23.July 2010
I was quite disappointed with the comments posted here, Christian has a good collection of tutorials/guides in his website. These kind of comments would come only from unprofessional people like you, be advised that you could not get it working only because you are incompetent and not because the guide is faulty. For the record, I could get it working (and I am not a software developer at all). Thank you for the good set of tutorials Christian.

If you were wondering how I got it to work, try adding PresentationFramework.Aero.dll to your project "References" as Ian states [And if you can not get this working, you should quite being an engineer and get a job in a fish market].

Christian, I am sorry about the harsh language used in my comment but people like these get on my nerves.
omer iqbal
Commented on 5.August 2010
christian you have done a good job prepared tutorials for learners i appreciate good job SIR..........
Commented on 18.August 2010
Anyone who cannot get this to work needs to learn to READ. I'm a total WPF newbie and had no trouble.
Tony Clark
Commented on 19.August 2010
Thanks for the article, really helpful to new users. Since, you are talking about themes, I would like to tell you that there are 7 free themes available at http://www.nukeation.com/free.aspx. I found these themes to be really useful.
Commented on 22.October 2010
I want to make data binding to my database of SQL SERVER 2008 but not getting any idea from this tutorial can i helped by ?
Laughing Man
Commented on 6.November 2010
read before crying. even noobs like me was able to figure things out after reading this article.
some old guy
Commented on 19.November 2010
I have to add my agreement, just glancing at this was enough for me to get this working. We are currently struggling with odd behaviour due to folks using all manner of themes. This inf ois simple, to the point and gold dust.
The truth is..
Commented on 12.January 2011
Commented on 29.January 2011
@The truth is: This site rulez. How many people have you helped, jackass?
Commented on 10.February 2011
Works F9
Commented on 3.March 2011
How can i import from existing style rather than creating new one.
Commented on 4.March 2011
You have explained about PresentationFramework.Aero ... Can u explain how to use PresentationFramework.Classic, PresentationFramework.Luna and PresentationFramework.Royale
Commented on 24.March 2011
Maybe the &lt;App.Resources&gt; tag should be like &lt;Application.Resources&gt;??

I changed it to &lt;Application.Resources&gt; didnt get any issue, but couldnt get the Aero style either.... By the way im using Windows XP.
Swati Shelke
Commented on 19.May 2011
Hey Chrisian Thanks a lot for good articles.
Commented on 31.May 2011
I'm on a WPF learning curve and you should avoid this blog if you really want to learn
Commented on 8.June 2011
That&Atilde;&Acirc;s really srhwed! Good to see the logic set out so well.
Commented on 8.June 2011
Nice stuff. the basics things are adding the assemblies, for those who cant get it to work install the toolkit themes. include them in your project , in a folder called themes and add this
&lt;UniformGrid Rows=&quot;6&quot; Columns=&quot;2&quot;&gt;
&lt;ObjectDataProvider xmlns:sys=&quot;clr-namespace:System;assembly=mscorlib&quot;
x:Key=&quot;data&quot; ObjectType=&quot;{x:Type sys:Enum}&quot; MethodName=&quot;GetNames&quot;&gt;
&lt;x:Type TypeName=&quot;sys:DayOfWeek&quot; /&gt;
&lt;Button Content=&quot;Windows Vista Aero&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Aero,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/aero.normalcolor.xaml&quot; /&gt;
&lt;Button Content=&quot;Windows 2000/2003 look&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Classic,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/Classic.xaml&quot; /&gt;
&lt;Button Content=&quot;Windows Media Center Edition&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Royale,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/royale.normalcolor.xaml&quot; /&gt;
&lt;Button Content=&quot;Windows XP(Green)&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Luna,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.homestead.xaml&quot;/&gt;
&lt;Button Content=&quot;Windows XP(Silver)&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Luna,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.metallic.xaml&quot; /&gt;
&lt;Button Content=&quot;Windows XP(Blue)&quot; Click=&quot;Change&quot; Tag=&quot;/PresentationFramework.Luna,Version=,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.normalcolor.xaml&quot; /&gt;
&lt;CheckBox Content=&quot;Checkbox&quot; /&gt;
&lt;RadioButton Content=&quot;RadioButton&quot; /&gt;
&lt;ProgressBar Value=&quot;50&quot; /&gt;
&lt;ComboBox SelectedIndex=&quot;0&quot; ItemsSource=&quot;{Binding Source={StaticResource data}}&quot; /&gt;
&lt;ListBox ItemsSource=&quot;{Binding Source={StaticResource data}}&quot; /&gt;
private void Change(object sender, RoutedEventArgs e)
Uri uriToTheme = new Uri((sender as Button).Tag.ToString(), UriKind.Relative);
object theme = Application.LoadComponent(uriToTheme);
this.Resources = (ResourceDictionary)theme;
Commented on 12.June 2011
There is nothing wrong with deleting comments.

Please delete any comments with
1. swear words
2. troll comments (comments that are complaints but don't add anything to this article)

When you are done deleting comments with swearing and troll comments, delete this comment as it also has nothing to do with this article.
Naveen G
Commented on 23.July 2011
Nice one ..!This is the one what i am searching for.Great!!

E-Mail (optional)