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:
- protected override void OnStartup(StartupEventArgs e)
- {
- var uri = new Uri("/PresentationFramework.AeroLite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35;component/themes/AeroLite.NormalColor.xaml", UriKind.Relative);
- App.Current.Resources.Source = uri;
- base.OnStartup(e);
- }
Copy code
|