PreviewMouseRightButtonUp does not fire when Context Menu is open
If I right-click on an Image I get the following events (shown in order):
1) MouseRightButtonDown
2) PreviewMouseRightButtonUp
3) MouseRightButtonUp
At this point my Application displays a context menu. If that is open, and I right click on the image again I only get this event:
1) MouseRightButtonDown
Nor sure what to do to get these events whe开发者_StackOverflown a context menu is open?
How do you track events? What code do you have? Have you checked events with Snoop? It has really nice feature where you can track all routed events. It always helps you to find out who handles what:
(source: blois.us)
And it shows that PreviewMouseUp is always coming, no matter ContextMenu is open or not...
PS: I know, I shouldn't write this before you answer previous questions, but have you tried:
img.AddHandler(PreviewMouseUpEvent, new MouseButtonEventHandler(ImgPreviewMouseUp), true /* Handled events too */);
void ImgPreviewMouseUp(object sender, MouseButtonEventArgs e)
{
//
}
:)
精彩评论