Table of Contents

Class MenuItem

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

A Shortcut-derived object to be used as a menu item in a Menu. Has title, an A Shortcut-derived object to be used as a menu item in a Menu. Has title, an associated help text, and an action to execute on activation.

public class MenuItem : Shortcut, IDisposable, ISupportInitializeNotification, ISupportInitialize, IOrientation, IDesignable
Inheritance
MenuItem
Implements
Derived
Inherited Members
Extension Methods

Constructors

MenuItem()

Creates a new instance of MenuItem.

MenuItem(string?, string?, Action?, Key?)
MenuItem(string?, string?, Menu?)
MenuItem(string, Key, Action?)
MenuItem(View?, Command, string?, string?, Menu?)

Creates a new instance of MenuItem, binding it to targetView and command. The Key targetView has bound to command will be used as Key.

Properties

Command

Gets the Command that will be invoked on TargetView when the MenuItem is selected.

SubMenu

The submenu to display when the user selects this menu item.

TargetView

Gets the target View that the Command will be invoked on.

Methods

Dispose(bool)

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

OnAccepted(CommandEventArgs)

Called when the user has accepted an item in this menu (or submenu). This is used to determine when to hide the menu.

OnMouseEnter(CancelEventArgs)

Called when the mouse moves over the View's Frame and no other non-SubView occludes it. MouseLeave will be raised when the mouse is no longer over the Frame.

RaiseAccepted(ICommandContext?)

Raises the OnAccepted(CommandEventArgs)/Accepted event indicating this item (or submenu) was accepted. This is used to determine when to hide the menu.

Events

Accepted

Raised when the user has accepted an item in this menu (or submenu). This is used to determine when to hide the menu.