Mouse.GotMouseCapture Mouse.GotMouseCapture Mouse.GotMouseCapture Attached Event

定義

發生於項目捕捉到滑鼠時。Occurs when an element captures the mouse.

see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler
see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler
see AddGotMouseCaptureHandler, and RemoveGotMouseCaptureHandler

備註

當項目捕捉到滑鼠時,不論資料指標位於其框線都會收到滑鼠輸入。When an element captures the mouse, it receives mouse input whether or not the cursor is within its borders.

這是附加的事件。This is an attached event. WPFWPF 將附加的事件實作為路由事件。implements attached events as routed events. 附加的事件基本上都XAMLXAML參考可以處理不會定義事件的物件的事件的語言概念的WPFWPF展開時也能周遊路由事件。Attached events are fundamentally a XAMLXAML language concept for referencing events that can be handled on objects that do not define that event, which WPFWPF expands upon by also enabling the event to traverse a route. 附加的事件並沒有直接處理語法在程式碼若要附加的程式碼中的路由事件處理常式,您會使用指定的新增 * 處理常式方法。Attached events do not have a direct handling syntax in code; to attach handlers for a routed event in code, you use a designated Add*Handler method. 如需詳細資訊,請參閱 < 附加事件概觀For details, see Attached Events Overview.

因為事件反昇的路由,已擷取的實際項目可能有子元素,而不一定實際附加事件處理常式的項目。Because of the bubbling routing, the actual element that has capture might be a child element, not necessarily the element where the event handler is actually attached. 檢查Source在事件引數以判斷實際項目具有滑鼠擷取。Check the Source in the event arguments to determine the actual element that has mouse capture.

路由事件資訊Routed Event Information

識別項欄位Identifier field GotMouseCaptureEvent
路由策略Routing strategy 事件反昇Bubbling
Delegate - 委派Delegate MouseEventHandler
  • 沒有任何已定義的對應通道事件。There is no defined corresponding tunneling event.

適用於