How to Keep Context Menu from Opening If Mouse Moved
I have a situation where holding down the right mouse button and moving the mouse effectively is panning a map on the screen. I want to have a context menu appear on right click but only if the map wasn't moved. It appears that the default Noesis context menu is opened when the right mouse button is released, how do I keep the context menu from opening when the right mouse is released if the mouse position is different from where it was when it was pressed?
-
-
sfernandez
Site Admin
- Posts: 3363
- Joined:
Re: How to Keep Context Menu from Opening If Mouse Moved
This is the standard behavior for context menus, they show when mouse up is released over an element with its ContextMenu property set, even if the mouse was moved in between.
What you can do is listening to PreviewMouseRightButtonDown, PreviewMouseMove and PreviewMouseRightButtonUp events to check if the mouse was moved and mark the Up event as handled in that case, so context menu is not raised in that situation.
Could you try something like this?
What you can do is listening to PreviewMouseRightButtonDown, PreviewMouseMove and PreviewMouseRightButtonUp events to check if the mouse was moved and mark the Up event as handled in that case, so context menu is not raised in that situation.
Could you try something like this?
Who is online
Users browsing this forum: Semrush [Bot] and 5 guests