Is there any way to find out that the mouse left-clicked up events outside an element in wpf?

I am defining an event for my border element that moves the left mouse button outside the bounds of this element.

+3
source share
2 answers

You can get a mouse event outside of the element that the mouse received if, at the direction of the mouse, you call element.CaptureMouse()(and when you click the mouse, remember to call element.ReleaseMouseCapture()).

+3
source
        Mouse.Capture (this,CaptureMode.SubTree);
        AddHandler ();

    private void AddHandler()
    {
        AddHandler (Mouse.PreviewMouseDownOutsideCapturedElementEvent,new MouseButtonEventHandler (HandleClickOutsideOfControl),true);
    }
0
source

Source: https://habr.com/ru/post/1785356/


All Articles