Bewerken

Share via


MenuItem.OnClick Method

Definition

Called when a MenuItem is clicked and raises a Click event.

protected:
 virtual void OnClick();
[System.Security.SecurityCritical]
[System.Security.SecurityTreatAsSafe]
protected virtual void OnClick ();
protected virtual void OnClick ();
[<System.Security.SecurityCritical>]
[<System.Security.SecurityTreatAsSafe>]
abstract member OnClick : unit -> unit
override this.OnClick : unit -> unit
abstract member OnClick : unit -> unit
override this.OnClick : unit -> unit
Protected Overridable Sub OnClick ()
Attributes

Remarks

If you inherit from MenuItem, be sure to call the base class to get the following behavior.

  • Toggling of the IsChecked property.

  • Focus being set to the menu item.

  • Automation invoke event.

  • Click event.

Applies to