Add the CaptureMouse method in your MouseButtonDown handler
You can look up here on what it actually does.
Вопрос
I want to be able in my WPF application to detect the MouseUp
event from anywhere. That is to say, if the user clicks in the control and holds his click, then releases it outside the Control, I want my MouseUp
event to fire.
I have done the MouseDown
event, it works, but the MouseUp event isn't fired if released outside the Window
.
Решение
Add the CaptureMouse method in your MouseButtonDown handler
You can look up here on what it actually does.
Другие советы
Another way is using the windows API's for mouse_event described here: Simulating Mouse Clicks
I would use the CaptureMouse listed above first but if that doesn't work for you this one should.