This article will follow soon...
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.
<App.Resources>
<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35,
ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
</App.Resources>
|
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
Greetings
Christian
|
|
|
|
disappointed | |
|
Commented on 18.February 2010 |
worst \"article\" ever
|
|
|
|
hi | |
|
Commented on 8.April 2010 |
Check this out http://wpfthemes.codeplex.com/
|
|
|
|
lan | |
|
Commented on 19.April 2010 |
Hi, The error message maybe because you did not include "PresentationFramework.Aero" to your project reference
|
|
|
|
marvl | |
|
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?
|
|
|
|
Joy | |
|
Commented on 8.July 2010 |
Thanks.. good one
|
|
|
|
Ashwin... | |
|
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..........
|
|
|
|
Jim | |
|
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.
|
|
|
|
Tribhuwan | |
|
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 |
THIS SITE IS HORSE SHIT!!! IT REALLY SUCKS !!!
|
|
|
|
hoodaticus | |
|
Commented on 29.January 2011 |
@The truth is: This site rulez. How many people have you helped, jackass?
|
|
|
|
ABC | |
|
Commented on 10.February 2011 |
Works F9
|
|
|
|
Simba | |
|
Commented on 3.March 2011 |
How can i import from existing style rather than creating new one.
Thanks.
|
|
|
|
R.Muthuselvi | |
|
Commented on 4.March 2011 |
You have explained about PresentationFramework.Aero ... Can u explain how to use PresentationFramework.Classic, PresentationFramework.Luna and PresentationFramework.Royale
|
|
|
|
Darcia | |
|
Commented on 24.March 2011 |
Maybe the <App.Resources> tag should be like <Application.Resources>??
I changed it to <Application.Resources> 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.
|
|
|
|
Andrei | |
|
Commented on 31.May 2011 |
I'm on a WPF learning curve and you should avoid this blog if you really want to learn
|
|
|
|
Stitches | |
|
Commented on 8.June 2011 |
That’s really srhwed! Good to see the logic set out so well.
|
|
|
|
ThaStyle | |
|
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
<UniformGrid Rows="6" Columns="2">
<UniformGrid.Resources>
<ObjectDataProvider xmlns:sys="clr-namespace:System;assembly=mscorlib"
x:Key="data" ObjectType="{x:Type sys:Enum}" MethodName="GetNames">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="sys:DayOfWeek" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</UniformGrid.Resources>
<Button Content="Windows Vista Aero" Click="Change" Tag="/PresentationFramework.Aero,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/aero.normalcolor.xaml" />
<Button Content="Windows 2000/2003 look" Click="Change" Tag="/PresentationFramework.Classic,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/Classic.xaml" />
<Button Content="Windows Media Center Edition" Click="Change" Tag="/PresentationFramework.Royale,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/royale.normalcolor.xaml" />
<Button Content="Windows XP(Green)" Click="Change" Tag="/PresentationFramework.Luna,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.homestead.xaml"/>
<Button Content="Windows XP(Silver)" Click="Change" Tag="/PresentationFramework.Luna,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.metallic.xaml" />
<Button Content="Windows XP(Blue)" Click="Change" Tag="/PresentationFramework.Luna,Version=3.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35;component/themes/luna.normalcolor.xaml" />
<CheckBox Content="Checkbox" />
<RadioButton Content="RadioButton" />
<ProgressBar Value="50" />
<ComboBox SelectedIndex="0" ItemsSource="{Binding Source={StaticResource data}}" />
<ListBox ItemsSource="{Binding Source={StaticResource data}}" />
</UniformGrid>
<x:Code>
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;
}
</x:Code>
|
|
|
|
Jared | |
|
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!!
|
|
|