Class MenuItem
Represents an individual item that is displayed within a menu.
[ControlCategory("Hidden")]
public class MenuItem : Menu, IBaseObjectWithId, IDisposableObject, IBaseObject, 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.
- MenuItem(string?, Func<bool>?)
Initializes a new instance of the MenuItem class with the specified
text
andonClick
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(object?) return value.
- CommandParameter
Gets the parameter that will be passed to the command when executing it.
- 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.
- IsDummy
Gets whether this control is dummy control.
- IsShortcutEnabled
Gets or sets whether Shortcut is enabled.
- 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.
- SvgImageSize
Gets or sets size of the svg image.
- Text
Gets or sets a value indicating the caption of the menu item.
Methods
- CreateHandler()
Creates a handler for the control.
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- GetRealImage(VisualControlState, bool?, Control?)
Gets real menu image for the specified state constructed from the following properties: Image, DisabledImage, SvgImage, SvgImageSize.
- OnClick(EventArgs)
Called when the control is clicked.
- RaiseClosed()
Raises Closed event.
- RaiseDisabledImageChanged()
Raises DisabledImageChanged event.
- RaiseHighlighted()
Raises Highlighted event.
- RaiseImageChanged()
Raises ImageChanged event.
- RaiseOpened()
Raises Opened event.
- RaiseShortcutChanged()
Raises ShortcutChanged event.
- 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.
- Closed
Occurs when menu item is closed.
- DisabledImageChanged
Occurs when the DisabledImage property changes.
- Highlighted
Occurs when menu item is highlighted.
- ImageChanged
Occurs when the Image property changes.
- Opened
Occurs when menu item is opened.
- RoleChanged
Occurs when the Role property changes.
- ShortcutChanged
Occurs when the Shortcut property changes.