12

I want to write a quick WPF application but am finding that it looks totally different on Windows 7 compared to Windows 10. All the paddings and margins are messed up. I decided to add the default PresentationFramework.Aero Windows 7 theme in the hope that this would resolve the issue. However, it seems that there are also two new options:

  • PresentationFramework.Aero.dll

In .NET 4.5 Microsoft has introduced two additional Assemblies:

  • PresentationFramework.AeroLite.dll
  • PresentationFramework.Aero2.dll

Which one do I use for a consistent look and feel including paddings and margins across Windows 7, 8 and 10.

Muhammad Rehan Saeed
  • 35,627
  • 39
  • 202
  • 311

2 Answers2

1

I upgraded an old wpf base project to .Net 6 and got a warning about incompatible aero versions. I just deleted the aero reference and the app was able to build/run in .Net 6 with no warnings or issues.

Error

warning MSB3243: No way to resolve conflict between "PresentationFramework.Aero ...

ΩmegaMan
  • 29,542
  • 12
  • 100
  • 122
  • I did the same when I stumbled across a reference to `System.IO.Compression` and it fixed it for me. I guess those assemblies are now part of .Net Core and referencing an older version of that makes that error. – Tim Nov 15 '22 at 17:24
0

WPF picks a default theme determined by the operating system version.This allows for applications to have a consistent look and feel across the entire OS, rather than each application defining its own look and feel, leading to a fragmented experience. This also allows users to make certain choices and have them reflected across their system.Of course, this is entirely overridable; WPF gives you access to the template and style of every control you have to use.

simply add the following code in your Application Startup event (following code showshow to use the Aero theme):

Uri uri = new Uri(“PresentationFramework.Aero;V3.0.0.0;31bf3856ad364e35;component\\themes/aero.normalcolor.xaml”, UriKind.Relative);
Resources.MergedDictionaries.Add(Application.LoadComponent(uri) as ResourceDictionary); 

choose your own theme and merge with MergedDictionary in App.xaml. It creates a unique look across all OS versions.

ReeganLourduraj
  • 863
  • 6
  • 9
  • Why the down votes? This answer is reasonable! I copied the example before the `InitializeComponent()` and it changes the 'style'. Maybe more explanation on how to construct the Uri would be nice. – minus one Jul 02 '18 at 18:56
  • Can you please add code, how to check which theme is available on the system? This maybe interesting [link](https://stackoverflow.com/questions/32827106/how-to-load-a-resource-from-an-uri-containing-its-assembly-and-path-from-any-ass?rq=1) – minus one Jul 02 '18 at 19:10