Is there any way to make applications on WinForms or WPF from XP up to 10 look the same? There is sometimes even a difference between Windows 7 and 10.

  • Or is there no general way to do this and everything must be manually changed for each Windows? - Timofey Bulankin
  • Do you need direct pixel match mapping or what? Because it looks the same, relatively. - Monk
  • Yes, 1 in 1 is straight. Is it possible to do this without much hemorrhoids? - Timofey Bulankin
  • Without hemorrhoids - definitely not. Better tell me what exactly does not suit, it may turn out that all the little things. - Monk

1 answer 1

See it.

The WPF framework contains several themes , each of which corresponds to a particular UI style. These themes are contained in publicly available assemblies, and are called PresentationFramework.*.dll .

You just need to connect these themes to your application and they will be applied. For example, if you want the entire application to have the Aero style, as in Windows 7, you should do the following: (1) connect the PresentationFramework.Aero.dll assembly to References, and (2) connect the styles in your App.xaml :

 <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Aero.NormalColor.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 

Similarly, you can hook up the PresentationFramework.Classic.dll assembly and styles

  <ResourceDictionary Source="/PresentationFramework.Classic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Classic.xaml"/> 

to get a visual style in the “classic” style of Windows XP (imitation of Windows 2000).

PresentationFramework.Luna.dll has several themes:

  <ResourceDictionary Source="/PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Luna.NormalColor.xaml"/> 

- standard Windows XP theme,

  <ResourceDictionary Source="/PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Luna.Metallic.xaml"/> 

- XP Silver theme (Metallic),

  <ResourceDictionary Source="/PresentationFramework.Luna, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Luna.Homestead.xaml"/> 

- XP Homestead green theme.

PresentationFramework.Royale.dll

  <ResourceDictionary Source="/PresentationFramework.Royale, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Royale.NormalColor.xaml"/> 

- XP Media Center Edition theme, etc.

If you want a view like in Window 8/10, you will need PresentationFramework.Aero2.dll and / or PresentationFramework.AeroLite.dll. They are available only on older versions of Windows, so for use on younger ones you will have to check the CopyLocal box and drag assemblies in the kit. They are on the same topic:

  <ResourceDictionary Source="/PresentationFramework.Aero2, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/Aero2.NormalColor.xaml"/> 

and

  <ResourceDictionary Source="/PresentationFramework.AeroLite, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 ;component/themes/AeroLite.NormalColor.xaml"/> 

You can, by the way, define styles locally, then only this piece of the application will correspond to your theme. For example:

Many buttons

PublicKeyToken, apparently , is always the same.

Additional reading on the topic: