简体   繁体   中英

WPF Context Menu is not in Windows 10 Style

I'm developing a simple WPF application. I don't use any custom styling. So it looks native on Windows 7 and 10. But today I have noticed that the context menu looks odd on Windows 10:

屏幕截图

In other applications like 7-Zip, context menus look native:

邮编

How can I apply the flat Window 10 style to my context menus without breaking the native look on Windows 7?

Clarification: My context menu has a 3D split line on the left hand and a border around the selction. In 7-Zip, Explorer and other applications, there are neither a 3D split line nor a border around selctions. I'm used that WPF applications looks unlike Java Swing as a nativ Windows application.

But today I have noticed that the context menu looks odd on Windows 10:

Odd or not, this is actually how the default WPF ContextMenu looks like on Windows 10.

How can I apply the flat Window 10 style to my context menus without breaking the native look on Windows 7?

You need to define this "flat Window 10 style" yourself. There is an example of how to create a custom ContextMenu style available on MSDN that should get you started: https://msdn.microsoft.com/en-us/library/ms744758%28v=vs.110%29.aspx . There is no quick fix.

You're getting hung up on the shortcut keys (>, Enter, Ctrl + PgDn, etc). Your application isn't assigning any, while 7-zip is assigning them. Or maybe, the outlining. Don't get thrown off. Things are working exactly as they should.

But let's not overlook the fact that if 7-zip is not written in WPF, you can't expect the same results.

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