I have few images in a grid, then when i click a button, a "open file dialog" comes up.(of course, over the images)
Microsoft.Win32.OpenFileDialog dlgOpenFiles = new Microsoft.Win32.OpenFileDialog(); dlgOpenFile.DoModal();
The images have a LeftButtonUp event attached. The problem is that if i select a file by double clicking it, the open file dialog closes(which is good), but besides that, the image behind the clicked file is receiving a LeftButtonUp message which is not good at all.
I am using wpf/c#/vs2010
The simple way to get around it, is whenever you need a handler to button-up event, add a button-down event, do
CaptureMouse()
in it. Now in your button-up event you can ignore all events, which happen withoutIsMouseCaptured
. And make sure not to forgetReleaseMouseCapture()
: