ContentElement.MouseEnter 事件


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

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





MouseEnter 是使用直接事件处理路由策略的 路由事件概述MouseEnter 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.

尽管 MouseEnter 跟踪鼠标指针进入元素边界的时间,但此事件更确切地报告 IsMouseOver 此元素的属性值已从更改 falsetrueAlthough MouseEnter tracks when the mouse pointer enters the bounds of an element, this event more literally reports that the IsMouseOver property value has changed from false to true on this element.

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

路由事件信息Routed Event Information

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