maui
maui copied to clipboard
Context menu support for Windows and MacCatalyst
Description of Change
Add new View.ContextFlyout property and implement right-click context menus on Windows and MacCatalyst.
Please refer to this comment to see what is and isn't supported.
Issues Fixed
Fixes #7777
I just started to experiment with the implementation of context menu for MAUI a few hours back. However, I started down a different path by using an attached property. I also considered a behaviour. Obviously, you decided to augment IView directly. Just wanted to point out alternatives.
Also here are links to docs on context menu for ios/macos and Android (which also supports this via 'PopupMenu' class):
https://developer.apple.com/documentation/uikit/uicontextmenuinteraction https://developer.android.com/guide/topics/ui/menus#context-menu
@profix898 thanks for sharing. I added directly to View because it seemed "most natural" to me, and roughly aligns with what WinUI and MacCatalyst do in their respective systems (which this MAUI implementation ultimately wraps). Do you see any pros/cons either way?
To @PureWeen and any other reviewers:
~~Per the linked comment above, the mainline scenarios should work: define a context menu on a compatible control and it will show up on MacOS and Windows. The main thing that really should work, but doesn't is: using {Binding ...} doesn't work (just like the MenuBar issue).~~ This is fixed and working now (@PureWeen)
I'd love to get this PR merged ASAP so that it can make its way to customers, while at the same time I can iterate on the missing features to continuously improve it. So, if you have concerns of what's in here, please do let me know, including whether the known limitations are acceptable at this time.
Thanks!