Oops, I have a lot of questions that can't find answers to them in Google. Everybody is just using codes, and nobody explains their purposes. What does Mouse.Captured
mean? And What does Mouse.Capture()
do? And (sorry the last one) when LostMouseCapture
occurs?
Asked
Active
Viewed 1,889 times
3

amiry jd
- 27,021
- 30
- 116
- 215
-
1The docs explain it pretty simply. "When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders. The mouse is typically captured in this manner only during drag-and-drop operations, and retains capture until the drop action of the drag-and-drop operation occurs." What is confusing about that? – Aug 09 '13 at 17:19
-
Does this answer your question? [What does it mean to "Capture the mouse" in WPF?](https://stackoverflow.com/questions/942357/what-does-it-mean-to-capture-the-mouse-in-wpf) – StayOnTarget Mar 18 '20 at 21:01
1 Answers
3
Basically, if you call Mouse.Capture
and pass in a input element, that input element (control) will always receive the mouse events, even if the mouse is outside of the bounds of the control.
The documentation is clear:
When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders.
Mouse.Captured
just lets you see if an input element has the mouse captured, and LostMouseCapture
occurs when the capturing stops.

Reed Copsey
- 554,122
- 78
- 1,158
- 1,373