Mouse.MouseUp Mouse.MouseUp Mouse.MouseUp Attached Event

定義

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

see AddMouseUpHandler, and RemoveMouseUpHandler
see AddMouseUpHandler, and RemoveMouseUpHandler
see AddMouseUpHandler, and RemoveMouseUpHandler

備註

已釋放的滑鼠按鍵是藉由檢查事件的引數所決定。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. 附加事件在程式碼中沒有直接處理語法;若要在程式碼中附加路由事件的處理常式, 您可以使用指定的 Add * 處理常式方法。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.

UIElement 通用語言執行平台 (CLR)common language runtime (CLR) MouseRightButtonUp MouseLeftButtonUp架構會在這個附加事件上建立, 其方式是在上將它呈現為兩個不同的事件: 和。 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)The 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: MouseLeftButtonUp and MouseRightButtonUp. 這些執行會處理基礎MouseUp事件並讀取事件的引數, 以判斷是否牽涉到左或右滑鼠按鍵。These implementations handle the underlying MouseUp event and read the arguments of the event to determine whether the left or right mouse button was involved. 針對三個按鈕, 中間按鈕沒有架構層級的事件支援, 而且您應該使用MouseUp事件並檢查事件引數中的置中按鈕條件。For three-button, there is no framework-level event support for the center button, and you should use the MouseUp 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. 做出適當選擇是否也應通知任何指定的滑鼠動作的相關問題, 是因為WPFWPF架構選擇將基礎Mouse路由事件呈現為CLRCLR所有路線中的事件。The difficulty in making the appropriate choices about whether parent 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 all along the route.

通道滑鼠事件也有類似的問題。Similar issues exist with tunneling mouse events. 如果您要處理事件, 而不是讓子系進一步向來源進行處理, 而且會如何影響控制項中的複合專案可能會有滑鼠行為預期的情況?Should you handle the event and not have it be handled by children further towards the source, and how would that affect compositing in a control where the compositing pieces might have expected mouse behaviors?

路由事件資訊Routed Event Information

識別碼欄位Identifier field MouseUpEvent
路由策略Routing strategy 路由Bubbling
Delegate - 委派Delegate MouseButtonEventHandler

對應的通道事件為PreviewMouseUpThe corresponding tunneling event is PreviewMouseUp.

適用於