UIElement.OnMouseLeave(MouseEventArgs) Method


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

 virtual void OnMouseLeave(System::Windows::Input::MouseEventArgs ^ e);
protected virtual void OnMouseLeave (System.Windows.Input.MouseEventArgs e);
abstract member OnMouseLeave : System.Windows.Input.MouseEventArgs -> unit
override this.OnMouseLeave : System.Windows.Input.MouseEventArgs -> unit
Protected Overridable Sub OnMouseLeave (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. 将事件标记为已处理仍然有助于防止调用典型的实例处理程序(未指定 handledEventsToo)。Marking the event as handled is still useful for preventing the typical instance handlers (those that do not specify handledEventsToo) from being invoked.

Applies to

See also