简体   繁体   中英

How can I use a modern Windows 10 context menu with a Win32 NotifyIcon?

My goal is to use the modern Windows 10 themed context menu with my C# application's tray icon. Eartrumpet's tray icon context menu uses it so I know it is possible, but I have had a lot of trouble deciphering how they did it. Simply changing the colors is not enough, I would like to use the same design as regular Windows 10 context menus.

This is what I want my application's tray icon menu to look like:

现代 UWP 主题

This is what I am stuck with:

旧的 win32 主题

如果要在Win32应用程序中使用MenuFlyout控件,可以参考本文档 ,该文档教您如何通过Windows Community Toolkit在Win32应用程序中使用uwp控件。您也可以在Win32应用程序的窗口中托管完整的uwp页面。

Apart from the great answer of Nico Zhu, I think that the Windows 10 taskbar context menu is just the normal one only styled differently.

This opinion is made even stronger by the fact that MSFT created the “dark” theme for the File Explorer simply by restyling it.

It is all only a different style, not new controls.

H.NotifyIcon.WinUI library allows you to create a native WinUI context menu with support for animations and themes - https://github.com/HavenDV/H.NotifyIcon/#winui-context-menu

在此处输入图像描述

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