ContentElement.OnMouseEnter(MouseEventArgs) Method

Definition

當這個項目上引發未處理的 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)

Parameters

e
MouseEventArgs

包含事件資料的 MouseEventArgsThe MouseEventArgs that contains the event data.

Remarks

這個方法沒有預設的實值。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. 視您的需求而定,您可以在特殊處理之前或之後呼叫基底。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