Add PreviewView support to ContextMenu for LongPressed mode#806
Draft
Add PreviewView support to ContextMenu for LongPressed mode#806
Conversation
- Add PreviewView bindable property to ContextMenu - iOS: create ContextMenuPreviewViewController to wrap MAUI view as UIViewController preview - iOS: use previewProvider in UIContextMenuConfiguration when PreviewView is set - Android: show PreviewView in a PopupWindow above anchor on long press, dismiss with menu - Add sample demonstrating PreviewView with a long document title use case - Update CHANGELOG.md (minor bump to 55.3.0) Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for document preview in menu options
Add PreviewView support to ContextMenu for LongPressed mode
Mar 2, 2026
Member
|
@copilot can you make sure the background gets dimmed / blurred on Android, and maybe add some shadow on the preview view? This will make it pop a bit more like it does on iOS. |
…opup - Wrap preview in FrameLayout with MaterialShapeDrawable (rounded corners, color_surface_default fill) and Elevation for shadow effect - Apply FLAG_DIM_BEHIND with 0.5 dimAmount on the PopupWindow after showing so the background dims behind the preview popup Co-authored-by: haavamoa <2527084+haavamoa@users.noreply.github.com>
Contributor
Author
Done in commit The
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
PreviewViewproperty toContextMenuso consumers can display a fully custom MAUI view as a preview on long-press — intended for cases like document lists where titles are truncated in the list row.Description of Change
ContextMenu.PreviewView— new bindableView?property, only meaningful inLongPressedmode.iOS —
ContextMenuPreviewViewControllerwraps the MAUI view as aUIViewControllerand is returned from theUIContextMenuConfigurationpreviewProviderlambda, giving the native "peek" experience above the context menu.Android —
ContextMenuHandlershows the preview in aPopupWindowanchored above the element when the long-press triggers. The popup is wrapped in aFrameLayoutwith aMaterialShapeDrawablebackground (rounded corners,color_surface_defaultfill) and shadow elevation. The background is dimmed usingFLAG_DIM_BEHINDwithdimAmount = 0.5fto give a similar feel to the iOS peek experience. The popup is auto-dismissed viaPopupMenu.IOnDismissListener.OnDismiss.Sample added to
ContextMenuSamples.xamldemonstrating a long document title + subtitle in the preview with two menu actions.Usage:
Todos
View original Slack conversation
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.