This blog describes how to apply Windows 8 themes under Windows 7.
First we look at a very common scenario, and the same WPF program (style not rewritten) is a little different on different operating systems. What is this for? the WPF program loads the theme that corresponds to the operating system when it starts. The following is a list of common OS themes that relate to WPF themes.
For different operating system themes, the WPF program loads different theme assembly. This results in the same XAML code showing up in different OSes.
Back to the topic of this blog, apply Windows 8 themes for WPF programs under Windows 7. From the table above, it is possible to know if we can apply the PresentationFramework.Aero2.dll theme to the WPF program.
1. Add a PresentationFramework.Aero2.dll reference to the WPF program;
2. set the Copy Local property of the PresentationFramework.Aero2.dll to true;
3. Add the following resource to the App.xaml;
<application.resources> <ResourceDictionary> <resourcedictionary.mergeddictionaries> <ResourceDictionary Source= "/presentationframework.aerolite;component/ Themes/aerolite.normalcolor.xaml " /> </resourcedictionary.mergeddictionaries> </ResourceDictionary></application.resources>
At this point, you run a program that applies the Windows 8 theme in a Windows 7 environment, with the following results:
You can get a assembly style dictionary for different WPF themes by Ilspy.
Thank you for reading!
WPF programs apply Windows 8 themes under Windows 7