MouseCapture prevents mouse based triggers from firing in WPF

I use CaptureMouse () during a drag and drop operation to make sure I haven't missed the MouseUp event, but that apparently prevents mouse events from reaching any other objects on my Canvas. This means my IsMouseOver based triggers are not working, but I need them to point to the correct locations where the object can be dropped.

Am I doing this wrong or is there a way to make sure everything on my Canvas is still receiving mouse events?

+1


source to share


1 answer


Are the elements part of the SubTree of your canvas? or outside the canvas? If they are inside, you can probably use the Capture method, which takes a CaptureMode .

Mouse.Capture(elementToCapture, CaptureMode.SubTree);

      



Alternatively, should you look at the DragDrop class and consider using the Drop Event instead?

+5


source







All Articles