However, you can use CaptureMode.SubTree to allow mouse events to
pass through to the clicked element if that clicked element is a child of the element that??™s performing the
capture. This makes sense if you??™re already using event bubbling or tunneling to watch mouse events in
child elements.
In some cases, you may lose a mouse capture through no fault of your own. For example,
Windows may free the mouse if it needs to display a system dialog box. You??™ll also lose the
mouse capture if you don??™t free the mouse after a mouse up event occurs and the user carries
on to click a window in another application. Either way, you can react to losing the mouse
capture by handling the LostMouseCapture event for your element.
While the mouse has been captured by an element, you won??™t be able to interact with
other elements. (For example, you won??™t be able to click another element on your window.)
Mouse capturing is generally used for short-term operations such as drag-and-drop.
CHAPTER 6 n DEPENDENCY PROPERTIES AND ROUTED EVENTS 178
Drag-and-Drop
Drag-and-drop operations (a technique for pulling information out of one place in a window
and depositing it in another) aren??™t quite as common today as they were a few years ago.
Programmers have gradually settled on other methods of copying information that don??™t
require holding down the mouse button (a technique that many users find difficult to master).
Pages:
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352