I would expect a default project for WPF to use the exact system theme, but the default theme for WPF looks somewhat akin to Windows 10, but not quite. And rather ugly if I had my opinion. My question is - how do I make WPF follow system theme?
Screenshot below is running in Windows 11. It's just a deafult project using File > New Project > WPF Application

This screenshot is from some random Visual Studio menu. Obviously these buttons look much different.

For consumer applications built on WPF and running on Windows 11, this feature enables them to leverage modern design elements and behaviors. This includes features such as:
WPF Gallery Preview - Working example in the Microsoft Store

This can be enabled:
Change the framework version to 9.0 in the csproj file
<TargetFramework>net9.0-windows</TargetFramework>
P.S. Minimum version of Visual Studio 2022 v17.12 with .NET 9
Adding the following to your App.xaml
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Official Wiki

Ways to connect topics:
Source="pack://application:,,,/PresentationFramework.Classic;component/Themes/Classic.xaml"
Source="pack://application:,,,/PresentationFramework.Luna;component/Themes/Luna.normalcolor.xaml"
Source="pack://application:,,,/PresentationFramework.Royale;component/Themes/Royale.normalcolor.xaml"
Source="pack://application:,,,/PresentationFramework.Aero;component/Themes/Aero.normalcolor.xaml"
Source="pack://application:,,,/PresentationFramework.Aero2;component/Themes/Aero2.normalcolor.xaml"
Source="pack://application:,,,/PresentationFramework.AeroLite;component/Themes/AeroLite.normalcolor.xaml"
Source="pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml"
I think the closest you will get to this is by using ModernWPF.
This is basically a port of WinUI to WPF, but only up until WinUI 2.6 when Microsoft introduced the Windows 11 styles. The project currently has open issues logged for Windows 11 styles but it's still up in the air as for whether it'll gain support for these anytime soon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With