Mouse.PreviewMouseUp Mouse.PreviewMouseUp Mouse.PreviewMouseUp Attached Event

定義

發生於放開任何滑鼠按鍵時。Occurs when any mouse button is released.

see AddPreviewMouseUpHandler, and RemovePreviewMouseUpHandler
see AddPreviewMouseUpHandler, and RemovePreviewMouseUpHandler
see AddPreviewMouseUpHandler, and RemovePreviewMouseUpHandler

備註

藉由檢查事件的引數,決定使用哪個滑鼠按鈕已釋放。Which mouse button was released is determined by checking the arguments of the event.

這是附加的事件。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.

Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) Framework 將根據此附加事件的呈現為兩個不同通用語言執行平台 (CLR)common language runtime (CLR)上的事件UIElement:PreviewMouseLeftButtonUpPreviewMouseRightButtonUpThe Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) framework builds on this attached event by surfacing it as two different 通用語言執行平台 (CLR)common language runtime (CLR) events on UIElement: PreviewMouseLeftButtonUp and PreviewMouseRightButtonUp. 這些實作會處理基礎PreviewMouseUp事件和讀取事件,以判定是否牽涉到左邊或右邊的滑鼠按鈕的引數。These implementations handle the underlying PreviewMouseUp event and read the arguments of the event to determine whether the left or right mouse button was involved. 針對三個按鈕沒有架構層級事件支援中心 按鈕,而且您應該使用PreviewMouseUp事件,並查看 中心 按鈕的條件在事件引數。For three-button, there is no framework-level event support for the center button, and you should use the PreviewMouseUp event and check for the center button condition in the event arguments.

針對與滑鼠相關路由事件,小心如何或當您將它們標示已處理。For routed events that relate to the mouse, be careful about how or when you mark them handled. 處理事件接近根目錄,並不會處理來源的更下層的可能不適合使用複合控制項,複合項目可能會有預期的滑鼠行為。Handling the event near the root and not handling by a child further toward the source may not be appropriate for composited controls, where the compositing pieces might have expected mouse behaviors. 做出最適當的選擇,關於是否其他項目也應被告知關於任何指定的滑鼠動作其實就是為什麼困難WPFWPFframework 選擇擁有基礎的模型Mouse路由的事件當成CLRCLR路由事件。The difficulty in making the appropriate choices about whether other elements should also be informed about any given mouse action is in fact why the WPFWPF framework chose the model of having the underlying Mouse routed event be surfaced as CLRCLR events along the route.

路由事件資訊Routed Event Information

識別項欄位Identifier field PreviewMouseUpEvent
路由策略Routing strategy 通道Tunneling
Delegate - 委派Delegate MouseButtonEventHandler
  • 對應的事件反昇事件是MouseUpThe corresponding bubbling event is MouseUp.

適用於