ContentElement.MouseLeave 事件


在鼠标指针离开此元素的边界时发生。Occurs when the mouse pointer leaves the bounds of this element.

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





MouseLeave 是使用直接事件处理路由策略的 路由事件概述MouseLeave is a Routed Events Overview that uses the direct event handling routing strategy. 直接路由事件不沿路由引发;相反,它们是在引发它们的同一元素中进行处理的。Direct routed events are not raised along a route; instead, they are handled in the same element where they are raised. 但是,它们会启用路由事件行为的其他方面,如样式中的事件触发器。However, they do enable other aspects of routed event behavior, such as event triggers in styles.

尽管 MouseLeave 跟踪鼠标离开元素的时间,但此事件更确切地报告 IsMouseOver true 此元素上的属性值已从更改为 falseAlthough MouseLeave tracks when the mouse leaves an element, this event more literally reports that the IsMouseOver property value has changed from true to false on this element.

此事件将为 Mouse.MouseLeave 此类创建附加事件的别名,因此 MouseLeaveContentElement 继承为基元素时,它是类成员列表的一部分。This event creates an alias for the Mouse.MouseLeave attached event for this class, so that MouseLeave is part of the class members list when ContentElement is inherited as a base element. 附加到事件的事件处理程序 MouseLeave 附加到基础 Mouse.MouseLeave 附加事件,并接收相同的事件数据实例。Event handlers that are attached to the MouseLeave event are attached to the underlying Mouse.MouseLeave attached event and receive the same event data instance.

路由事件信息Routed Event Information

标识符字段Identifier field MouseLeaveEvent
路由策略Routing strategy 直接Direct
委托Delegate MouseEventHandler
  • 重写 OnMouseLeave 以在派生类中实现此事件的类处理。Override OnMouseLeave to implement class handling for this event in derived classes.