UIElement.MouseLeftButtonUp Event


在鼠标指针位于此元素上并且松开鼠标左键时发生。Occurs when the left mouse button is released while the mouse pointer is over this element.

 virtual event System::Windows::Input::MouseButtonEventHandler ^ MouseLeftButtonUp;
public event System.Windows.Input.MouseButtonEventHandler MouseLeftButtonUp;
member this.MouseLeftButtonUp : System.Windows.Input.MouseButtonEventHandler 
Public Custom Event MouseLeftButtonUp As MouseButtonEventHandler 



尽管此路由事件似乎会在元素树中跟随冒泡路由,但它实际上是一个直接路由事件,每个 UIElement都会沿着元素树引发并 reraised 该事件。Although this routed event seems to follow a bubbling route through an element tree, it actually is a direct routed event that is raised and reraised along the element tree by each UIElement.

此事件是多个相关事件之一,用于报告基础 Mouse.MouseUp 事件的鼠标按钮细节,该事件是由事件路由中的每个元素处理的附加事件。This event is one of several related events that report the mouse-button specifics of an underlying Mouse.MouseUp event, which is an attached event that is processed by each element along an event route.

此事件的事件数据公开基础 Mouse.MouseUp 事件的事件数据。The event data of this event exposes the event data of the underlying Mouse.MouseUp event. 如果该事件在事件路由中标记为 "已处理",则仍会引发鼠标按钮特定的事件;但是,必须通过显式调用 AddHandler来添加鼠标按钮特定事件的处理程序,并且可以选择处理已标记为已处理的事件,以便作为事件的侦听器。If that event is marked as handled along the event route, the mouse-button specific events are still raised; however, handlers of the mouse-button specific events must be added by explicitly calling AddHandler, with the option to handle events that are already marked as handled, in order to be listeners to the event. 如果将 MouseLeftButtonUp 标记为 "已处理",则实质上是将为沿着路由的所有其他侦听器和所有相关事件标记 Mouse.MouseUp 处理。If you mark MouseLeftButtonUp handled, you are essentially marking Mouse.MouseUp handled for all further listeners along the route, and on all related events.

从概念上讲,将此事件(以及 UIElement上的其他鼠标按钮事件)视为鼠标 "服务" (使用 Mouse 类提供的服务定义)。Conceptually, think of this event (and other mouse-button events on UIElement) to be a mouse "service" (with the service definition provided by the Mouse class). 事件增加了不需要在事件数据中检查鼠标按钮状态(从左到右、向下)的原始鼠标事件的便利。The event adds the convenience of not needing to check the mouse button states (left-right, up-down) of the original mouse events in the event data. 对于更高级的方案,如检查非标准按钮的状态,可能需要使用 Mouse 类上的 Api,而不是 UIElement上的 Api。For more advanced scenarios, such as checking for states of non-standard buttons, you might need to use the APIs on the Mouse class rather than those on UIElement.

路由事件信息Routed Event Information

标识符字段Identifier field MouseLeftButtonUpEvent
路由策略Routing strategy 直接Direct
委托Delegate MouseButtonEventHandler

Applies to

See also