This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19503|Reply: 1

[WPF] Let your WPF program render Win8 style themes under Win7

[Copy link]
Posted on 12/8/2015 4:22:51 PM | | | |


Today, when I used a WPF program I wrote before under Win8, I found that Win8 effects are now supported (remember that the previous version of .NET 4.0 was not supported). Since WPF's controls are self-drawn and not controlled by the system theme, that is to say, .NET 4.5 comes with Win8 theme style files, and it stands to reason that this style can also be used under Win7.

I put . Several topic paths supported under Net 4.5 are extracted as follows:

Win8(AeroLite):  /PresentationFramework.AeroLite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes/aerolite.normalcolor.xaml
Win7 (Aero):  /PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes/aero.normalcolor.xaml
WinXP Royale: /PresentationFramework.Royale, version=4.0.0.0, culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes/royale.normalcolor.xaml
WinXP Blue (Luna): /PresentationFramework.Luna, version=4.0.0.0, culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes/luna.normalcolor.xaml
WinXP Silver (Luna): /PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes/luna.metallic.xaml
WinXP Luna: /PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes /luna.homestead.xaml
Win98(Classic):  /PresentationFramework. Classic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; component/themes /classic.xaml
Note: I am taking the . Net 4.5 style file path, others. The path of the Net version may be slightly different, but it basically comes out when you use ILSpy to see it.

With these style paths, you can apply the global style at startup to render Win8's AeroLite effect in Win7:


  1. protected override void OnStartup(StartupEventArgs e)
  2.     {
  3.         var uri = new Uri("/PresentationFramework.AeroLite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35;component/themes/AeroLite.NormalColor.xaml", UriKind.Relative);
  4.         App.Current.Resources.Source = uri;
  5.         base.OnStartup(e);
  6.     }
Copy code






Previous:.net implements a simple web server using HttpListener
Next:It seems that this place has not been updated for a long time, and I will update the C language every day in the future.
 Landlord| Posted on 12/8/2015 4:23:23 PM |
This is. The .Net 4.5 program that comes with the Net Framework can be used by copying the code I wrote above.
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com