ContextMenu opened from DataGrid.CellPointerPressed doesn’t appear if right-click happens too quickly after left-click #20383
Unanswered
BillGatesGames
asked this question in
Q&A
Replies: 2 comments 3 replies
-
|
You may want to try Dispatcher.UiThread.Post in order to delay the show a bit. |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
"If the user left-clicks a row and then right-clicks very quickly" can be an unnecessary sequence. To open the context menu, the user can directly right click to trigger without a left click in advance. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I’m using Avalonia DataGrid and I want to show a context menu on right-click.
I’m handling CellPointerPressed (or DataGridCellPointerPressedEventArgs) and creating/opening a ContextMenu programmatically.
What I do:
Problem:
The context menu only appears if the user waits a small moment after a left-click (selecting a row) before doing the right-click (opening the context menu).
If the user left-clicks a row and then right-clicks very quickly:
So it looks like the open call “succeeds”, but the menu is not shown unless there is a small pause between the clicks.
Question:
What could cause this timing-dependent behavior?
Could it be related to pointer event handling, focus/selection updates inside DataGrid, or event routing/capture? Any recommended pattern for reliably opening a context menu in this scenario?
Beta Was this translation helpful? Give feedback.
All reactions