Mouse.MouseUp 附加事件


發生於放開任何滑鼠按鍵時。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.

Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF)架構會在這個附加事件上建立,其方式是在上將它呈現為兩個不同 通用語言執行平台 (CLR)common language runtime (CLR) 的事件 UIElementMouseLeftButtonUpMouseRightButtonUpThe 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 路由事件呈現為整個路由中事件的模型,這是很困難的 CLRCLRThe 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 MouseButtonEventHandler

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