WPF programs apply Windows 8 themes under Windows 7

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.