Edit

Share via


TextBoxBase.OnContextMenuOpening(ContextMenuEventArgs) Method

Definition

Called whenever an unhandled ContextMenuOpening routed event reaches this class in its route. Implement this method to add class handling for this event.

protected:
 override void OnContextMenuOpening(System::Windows::Controls::ContextMenuEventArgs ^ e);
[System.Security.SecurityCritical]
protected override void OnContextMenuOpening (System.Windows.Controls.ContextMenuEventArgs e);
protected override void OnContextMenuOpening (System.Windows.Controls.ContextMenuEventArgs e);
[<System.Security.SecurityCritical>]
override this.OnContextMenuOpening : System.Windows.Controls.ContextMenuEventArgs -> unit
override this.OnContextMenuOpening : System.Windows.Controls.ContextMenuEventArgs -> unit
Protected Overrides Sub OnContextMenuOpening (e As ContextMenuEventArgs)

Parameters

e
ContextMenuEventArgs

Arguments of the event.

Attributes

Remarks

This method has no default implementation. You should still call the base implementation in case an intermediate class in the inheritance has implemented this method.

The purpose of this method is somewhat similar to common language runtime (CLR) event pattern On* methods: it lets you handle the matching event from derived classes by using a class handler instead of an instance handler. In this case, the matching event is a routed event. The implementation pattern of the On* methods is different for routed events because the routed event might have been raised by a child element, which is not necessarily the element that invokes handlers. Therefore, your implementation needs to take the event arguments' source properties into account (and should not try to re-raise the event in most cases). Subclasses of TextBoxBase can call private class handler methods when the event is received along the route. One scenario is to take the arguments of the event and deliberately mark the event as handled.

Applies to