vmahdavi
vmahdavi

Reputation: 419

Is there any way to find out mouse left button up event outside of an element in wpf?

I will define an event for my border element that relize mouse left button up outside of this element.

Upvotes: 3

Views: 1010

Answers (2)

mohsen mousavi
mohsen mousavi

Reputation: 372

        Mouse.Capture (this,CaptureMode.SubTree);
        AddHandler ();

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

Upvotes: 0

Andrei Pana
Andrei Pana

Reputation: 4502

You can get mouse up event outside the element who received mouse down, if on the mouse down you call element.CaptureMouse() (and on mouse up, do not forget to call element.ReleaseMouseCapture()).

Upvotes: 3

Related Questions