Class MenuItem
Represents an individual item that is displayed within a menu.
[ControlCategory("Hidden")]
public class MenuItem : Menu, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo, ICommandSource
- Inheritance
-
MenuItem
- Implements
- Derived
Constructors
- MenuItem()
Initializes a new instance of the MenuItem class.
- MenuItem(string?)
Initializes a new instance of the MenuItem class with the specified
text
for the menu item.
- MenuItem(string?, Image, EventHandler)
Initializes a new instance of the MenuItem class that displays the specified text and image and that does the specified action when the MenuItem is clicked.
- MenuItem(string?, KeyGesture)
Initializes a new instance of the MenuItem class with the specified
text
andshortcut
for the menu item.
- MenuItem(string?, Action?)
Initializes a new instance of the MenuItem class with the specified
text
andonClick
for the menu item.
- MenuItem(string?, Action?, KeyGesture?)
Initializes a new instance of the MenuItem class with the specified
text
,onClick
andshortcut
for the menu item.
- MenuItem(string?, EventHandler?, KeyGesture?)
Initializes a new instance of the MenuItem class with the specified
text
,onClick
andshortcut
for the menu item.
Properties
- Checked
Gets or sets a value indicating whether a check mark appears next to the text of the menu item.
- ClickAction
Gets or sets Action which will be executed when this MenuItem is clicked by the user.
- Command
The command that will be executed when the class is "invoked." Classes that implement this interface should enable or disable based on the command's CanExecute return value. The property may be implemented as read-write if desired.
- CommandParameter
The parameter that will be passed to the command when executing the command. The property may be implemented as read-write if desired.
- CommandTarget
An element that an implementor may wish to target as the destination for the command. The property may be implemented as read-write if desired.
- ControlKind
Returns control identifier.
- DisabledImage
Gets or sets disabled image associated with the menu item.
- EnabledFunc
Gets or sets function which is called inside OnOpening(CancelEventArgs) in order to update enabled state.
- Image
Gets or sets image associated with the menu item.
- IsDummy
Gets whether this control is dummy control.
- Role
Gets or sets this menu item's role, which is used to automate macOS-specific standard items layout.
- Shortcut
Gets or sets a value indicating the shortcut key associated with the menu item.
- ShortcutKeys
Gets or sets the shortcut keys associated with the MenuItem.
- Text
Gets or sets a value indicating the caption of the menu item.
Methods
- CreateHandler()
Creates a handler for the control.
- OnClick(EventArgs)
Called when the control is clicked.
- SetShortcutKeys(Keys)
Same as ShortcutKeys but implemented as method.
- ToString()
Returns a string that represents the current object.
Events
- CheckedChanged
Occurs when the Checked property changes.
- DisabledImageChanged
Occurs when the DisabledImage property changes.
- ImageChanged
Occurs when the Image property changes.
- RoleChanged
Occurs when the Role property changes.
- ShortcutChanged
Occurs when the Shortcut property changes.