This project is read-only.

Do these themes work with WPF?

Nov 6, 2009 at 4:43 PM

I tried a couple of the themes, such as the UX red/green and they wouldn't work in my WPF app.  Are the SL themes not compatible with WPF? If not, then I would suggest changing the site a bit because it leads people to believe they do indeed work.

If they do work, what do I need to do? Most of the problems were from the Visual State Manager which doesn't seem to exist in WPF.


Nov 6, 2009 at 5:29 PM

Visual State Manager is included with the WPF Toolkit ( you will need to reference this assembly for the skins to work. SL themes in general are not compatible with WPF, these particular themes though have been ported by rudi.

Jan 22, 2010 at 9:21 AM

I've been trying to get the basic released themes to work in a WPF Project.

Downloaded the WPFToolkit and Silverlight 3 SDK.

Referencing the WPFToolkit.dll works fine with my project, but when I try to reference System.Windows.Controls.Theming.Toolkit.dll

it keeps telling me I have an a Assembly mismatch. The .xaml Theme files reference that *.dll and examples have shown to include it.

Where am I going wrong on this?

I'd appreciate any advice / help.


Thanks in advance

Jan 22, 2010 at 10:31 AM

Unless your really want to go down the dll root I would suggest using the raw xaml files instead. Remove reference to System.Windows.Controls.Theming.Toolkit.dll

and in your constructor or window.load handling add the following.

//New resource dictionary.
ResourceDictionary skin = new ResourceDictionary();

//Set new source.
skin.Source = new Uri(@"C:\myskin.xaml", UriKind.Absolute);


Where "C:\myskin.xaml is the absolute path to the theme you wish to apply. Using the raw xaml as aposed to the dll means you can customize the styles yourself. Also if you move the above code to a method you can change the theme during runtime.

Jan 22, 2010 at 10:54 AM

First of all, thanks for the speedy reply Nobster.

So I started from scratch:

New WPF App; referenced WPFToolKit, added your code to constructor window for testing; added fresh "System.Windows.Controls.Theming.ExpressionDark.xaml" to Project.

and.....nothing :) no build for me

Is my assumption correct that I have to alter the ResourceDir of the "Theme".xaml ?

I altered the line xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" to

the WPFToolKit assembly but that only led to another row of errors...

What am I missing? :) The WPF Theme section described porting these themes as totally simple :(

Jan 22, 2010 at 11:20 AM

In the line skin.Source = new Uri(@"C:\myskin.xaml", UriKind.Absolute); change C:\myskin.xaml to wherever you have the xaml file on your harddisk.

So if your expressiondark.xaml file was called expressiondark.xaml and was sitting on the root you would rename C:\myskin.xaml to C:\expressiondark.xaml.

You don't need to change anything in the xaml itself and nothing other then WpfToolkit  needs to be added to the project although I'm sure you could add the xaml file as a resource but then you'll need different syntax to use it.

Above when you say  "nothing :) no build for me" do you mean your getting an error?

Jan 22, 2010 at 11:47 AM

To clear things up I added and altered your code to point to my .xaml sorry should have written that.

here the constructor code:

public partial class Window1 : Window
        public Window1()
            //New resource dictionary.
            ResourceDictionary skin = new ResourceDictionary();

            //Set new source.
            skin.Source = new Uri(@"D:\VS2008_Projects\WpfApplication1\WpfApplication1\System.Windows.Controls.Theming.ExpressionDark.xaml", UriKind.Absolute);


and here whats in the ResourceDirectory at the top of the ExpressionDark.xaml:
<ResourceDictionary xmlns=""
                    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"  >

I have referenced the WPFToolkit and added the file to my project. The xaml file is found through your code. But I get errors and it won't build:
Error	1	The property 'UseLayoutRounding' does not exist in XML namespace ''. Line 84 Position 60.	D:\VS2008_Projects\WpfApplication1\WpfApplication1\System.Windows.Controls.Theming.ExpressionDark.xaml	84	60	WpfApplication1
And that's just one of many, I am referencing something wrong? ...
Jan 22, 2010 at 11:55 AM

I had made one change to the DarkExpression.xaml


was the original state of the entry. If I leave it at that I can an error stating that

Error	1	The tag 'VisualStateManager.VisualStateGroups' does not exist in XML namespace 'clr-namespace:System.Windows;assembly=System.Windows'. Line 33 Position 14.	D:\VS2008_Projects\WpfApplication1\WpfApplication1\System.Windows.Controls.Theming.ExpressionDark.xaml	33	14	WpfApplication1


so yeah.......I 'm kinda stumped

Jan 22, 2010 at 12:06 PM
Edited Jan 22, 2010 at 12:12 PM

Ok not sure why all those assembly references are in there. Where did you get this version of the theme?

I re-downloaded the one from microsoft to check and it looks like this


I would re-download expression dark from here,

or try my modified theme which supports calendar and datagrid as well

EDIT: I would also call  InitializeComponent(); before running any other code but I don't think it matters when just loading a theme.

Jan 22, 2010 at 12:26 PM

It compiles! :D And the button looks expressionistically Dark :D

Ok the breakdown:

It was indeed the wrong xaml file. And guess I found out my error:

The describing sentence:

An updated collection of seven themes replaces the original nine WPF Themes. 
Some of the issues with the original themes have been addressed in this update. 
Download the WPF Themes in the WPF Futures release. This collection of themes can also be found in the Silverlight Toolkit. 
Led me to believe I could take the design files out of my Silverlight SDK that I had already downloaded.
But I guess those are specifically for Silverlight(?).
Thank you very very much for the troubleshooting help Nobster.
Jan 22, 2010 at 12:34 PM

No worries, glad you got it sorted