ContentElement.OnMouseEnter(MouseEventArgs) 方法


当此元素引发未处理的 MouseEnter 附加事件时调用。Invoked when an unhandled MouseEnter attached event is raised on this element. 实现此方法可为此事件添加类处理。Implement this method to add class handling for this event.

protected public:
 virtual void OnMouseEnter(System::Windows::Input::MouseEventArgs ^ e);
protected internal virtual void OnMouseEnter (System.Windows.Input.MouseEventArgs e);
abstract member OnMouseEnter : System.Windows.Input.MouseEventArgs -> unit
override this.OnMouseEnter : System.Windows.Input.MouseEventArgs -> unit
Protected Friend Overridable Sub OnMouseEnter (e As MouseEventArgs)



包含事件数据的 MouseEventArgsThe MouseEventArgs that contains the event data.


此方法没有默认实现。This method has no default implementation. 因为继承中的中间类可能实现此方法,所以建议您在实现中调用基实现。Because an intermediate class in the inheritance might implement this method, we recommend that you call the base implementation in your implementation. 您可以根据自己的要求,在特殊处理之前或之后调用 base。You may call base either before or after your special handling, depending on your requirements.

此方法的用途类似于 公共语言运行时 (CLR)common language runtime (CLR) 方法的事件模式 * :此方法提供了通过建立类处理程序而不是实例处理程序来处理来自派生类的匹配事件的方法。The purpose of this method is similar to the 公共语言运行时 (CLR)common language runtime (CLR) event pattern On* methods: this method provides the means to handle the matching event from derived classes by establishing a class handler instead of an instance handler. 在这种情况下,匹配事件是路由事件,其中包含直接路由策略。In this case the matching event is a routed event, with a direct routing strategy. 将事件标记为已处理仍然有助于防止典型的实例处理程序 (未指定调用) 的实例处理程序 handledEventsTooMarking the event as handled is still useful for preventing the typical instance handlers (those that do not specify handledEventsToo) from being invoked.