简体   繁体   中英

WPF/XAML doesn't look like system theme

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

显示 WPF 的图像

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

在此处输入图片说明

I would expect a default project for WPF to use the exact system theme ...

I am afraid your expectation is wrong. The default WPF templates have not been updated for Windows 11 and I strongly doubt they ever will be.

If you want a modern UI experience in your Windows apps, I would recommend you to look into using WinUI (3). It's the the next generation native UI layer for Windows, including full-trust desktop apps.

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.

I cannot answer your question, but I suspect that you just want to make the appearance more attractive.

To do this, you can use the style libraries. For example here. I used it myself for applications. Very easy to learn:

https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit

And here. I haven't used it, but it looks interesting:

https://microsoft.github.io/microsoft-ui-xaml/

There's a WinUI 3 port for WPF called WPFUI . It requires some simple steps to modernize your WPF application and make it look like Windows 11 new UI (Unlike XAML Island where you have to do dozens of steps and still need to change your UI codes and create another project in the solution)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM