WindowsAppSDK
WindowsAppSDK copied to clipboard
Proposal: Support theming of user32 controls like the system menu
I noticed this months ago but I didn't know where to put it at the time. So, I kinda forgot about it.
This reddit post reminded me of it. https://www.reddit.com/r/Windows10/comments/hhwn2z/so_when_i_can_expect_the_context_menus_to_have/
If you right click on the title bar in a Win32 and UWP app, the context menu doesn't match the styling of the context menu used in the app. It also does not match the system selected theme.
I have Dark Mode selected.
Win32:

UWP:

This should produce a theme aware Xaml Context Menu with WinUI 3 apps - there is no backwards compatible reasons not to
The system menu is a user32 control dating from before the advent of theming. It's possible that "lifting" some of this code would allow us to update it to support theming. That's more than a bugfix, so let me update the title to a proposal that we can consider in the context of Reunion.
Related to #41. Using the APIs I named there gives you a dark context menu, like currently seen on Explorer:

Related to #41. Using the APIs I named there gives you a dark context menu, like currently seen on Explorer:
Hi. Would you like to share a basic demo code to get a dark context menu? I've seen the other issue, and there are different (undocumented) methods there that I don't know exactly what would be used to accomplish such task.
See https://github.com/ysc3839/win32-darkmode. There's a bit more setup involved if your app shows more than a context menu, but if it only shows context menus (eg a tray icon only app), only calling SetPreferredAppMode and AllowDarkModeForWindow for the window that hosts the context menus is sufficient.
This can be related to #41 where the undocumented dark theme api from uxtheme.dll is being used to enable dark styling on common controls, the ribbon framework, and more.
Also, it'd be great in general if menu bars could be could listen to dark mode, not just the context menus themselves.
That white menu bar as seen in the last screenshot is horrible too. Doesn't even follow the configured system palette at all (it's supposed to be some grayish color.) Just appears to be hardcoded to be white everywhere currently, for some reason... It does make every classic application look pretty ugly.
#82
This is different. The proposal outlined here is about allowing developers more control over the appearance of their app, not changing the default styles.
i understood. :)
i put that there thinking of the MS Edge case.
The whole purpose of this proposal if for apps to have consistency. New apps should not have a context menu that doesn't match the system theme nor should they have one that doesn't match the rest of the OS.
Right clicking on a title bar should present a WinUI 3.0 updated context menu, how Windows 10 looks, not a context menu from Windows Vista.
How about using these kinds of menus? (This is with the system theme set to light mode.)

Yes, they aren't being drawn by UWP, but ApplicationFrameHost.exe which creates the UWP Window can draw that instead of the classic one shown below.

The newer one looks modern and adapts to the current Windows theme too, which is a plus.
Or even better, replace ALL right click titlebar menus with the one above.
Or even better, replace ALL right click titlebar menus with the one above.
This literally why I made it.
@shaheedmalik My bad, I thought you just wanted the legacy Win32 context menus to follow the current theme settings instead of using the updated context menu that explorer uses.
@shaheedmalik My bad, I thought you just wanted the legacy Win32 context menus to follow the current theme settings instead of using the updated context menu that explorer uses.
I made it because UWP apps don't product an updated context menu. If you go into an app like calculator and right click in the app, it will produce a different context menu than if you right click on the title bar. This problem also happens in Win32 apps, so I posted it in Reunion.
Because the title bar is handled by the shell, I think it's on the shell team to update the context menu to the up to date WinUI 3 context menu, and make it theme aware.
So the title was misleading me then. This is not supporting theming but just updating the default style.
So the title was misleading me then.
Yeah, same here.
I am not sure why the confusion, Steve above stated why he changed the name of the proposal.
It's funny how much this issue changed from a misunderstanding of how we want this to be fixed. I think that for the most part, this should be about updating the default styles and perhaps in this case, wrapping menus in WinUI menus. Supporting theming for this menu wouldn't benefit any of Microsoft's products too so I'm not sure why they'd choose that approach as it's more work for them.
It's funny how much this issue changed from a misunderstanding of how we want this to be fixed. I think that for the most part, this should be about updating the default styles and perhaps in this case, wrapping menus in WinUI menus. Supporting theming for this menu wouldn't benefit any of Microsoft's products too so I'm not sure why they'd choose that approach as it's more work for them.
All that really should be done is update that particular context menu to the new WinUI 3 style and update it so it will reflect the system's color whether light or dark.
At the time I made the proposal, I didn't know that menu was a system menu that was handled by the shell team. I just thought it affected both UWP and Win32.
Others want to say this particular proposal is linked to theirs so theirs would get approved, but it isn't the case at all.
Others want to say this particular proposal is linked to theirs so theirs would get approved, but it isn't the case at all.
That only happened because this issue got muddled up. You shouldn't blame anyone for linking issues and you can't turn back time so they are definitely relevant.
So is this the right ask? "UWP and Win32 Reunion apps should have a default system menu that matches the app or system theme?"
So is this the right ask? "UWP and Win32 Reunion apps should have a default system menu that matches the app or system theme?"
Yep.
So is this the right ask? "UWP and Win32 Reunion apps should have a default system menu that matches the app or system theme?"
Why not use the WinUI context flyout control, instead of using the Win32 version, with or without app theme support?
Because it requires the entire WinUI stack for a mere context menu? That means Win32 apps which previously took 1mb of RAM now take at least 15.
For. a. context. menu.
Because it requires the entire WinUI stack for a mere context menu? That means Win32 apps which previously took 1mb of RAM now take at least 15.
For. a. context. menu.
This is a good point, providing the app does not use WinUI at all
WinUI desktop apps totally can (and should) replace that by some sort of dev-customizable flyout. Probably UWP as well given the extension points required are added.
That's why I was suggesting to restyle those menus. If it's up to devs to opt in, hardly any app will use it, which is what (I think) @shaheedmalik also thinks.