Class ContextMenu
A context menu window derived from MenuBar containing menu items
which can be opened in any position.
Inheritance
System.Object
ContextMenu
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public sealed class ContextMenu : IDisposable
Constructors
ContextMenu()
Initialize a context menu with empty menu items.
Declaration
public ContextMenu()
ContextMenu(Int32, Int32, MenuBarItem)
Initialize a context menu with menu items.
Declaration
public ContextMenu(int x, int y, MenuBarItem menuItems)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | The left position. |
System.Int32 | y | The top position. |
MenuBarItem | menuItems | The menu items. |
ContextMenu(View, MenuBarItem)
Initialize a context menu with menu items from a host View.
Declaration
public ContextMenu(View host, MenuBarItem menuItems)
Parameters
Type | Name | Description |
---|---|---|
View | host | The host view. |
MenuBarItem | menuItems | The menu items. |
Properties
ForceMinimumPosToZero
Gets or sets whether forces the minimum position to zero
if the left or right position are negative.
Declaration
public bool ForceMinimumPosToZero { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Host
The host View which position will be used,
otherwise if it's null the container will be used.
Declaration
public View Host { get; set; }
Property Value
Type | Description |
---|---|
View |
IsShow
Gets information whether menu is showing or not.
Declaration
public static bool IsShow { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Key
The Key used to activate the context menu by keyboard.
Declaration
public Key Key { get; set; }
Property Value
Type | Description |
---|---|
Key |
MenuBar
Gets the MenuBar that is hosting this context menu.
Declaration
public MenuBar MenuBar { get; }
Property Value
Type | Description |
---|---|
MenuBar |
MenuItens
Gets or sets the menu items for this context menu.
Declaration
public MenuBarItem MenuItens { get; set; }
Property Value
Type | Description |
---|---|
MenuBarItem |
MouseFlags
The MouseFlags used to activate the context menu by mouse.
Declaration
public MouseFlags MouseFlags { get; set; }
Property Value
Type | Description |
---|---|
MouseFlags |
Position
Gets or set the menu position.
Declaration
public Point Position { get; set; }
Property Value
Type | Description |
---|---|
Point |
UseSubMenusSingleFrame
Gets or sets if the sub-menus must be displayed in a single or multiple frames.
Declaration
public bool UseSubMenusSingleFrame { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
Dispose()
Declaration
public void Dispose()
Hide()
Close the MenuItens menu items.
Declaration
public void Hide()
Show()
Open the MenuItens menu items.
Declaration
public void Show()
Events
KeyChanged
Event invoked when the Key is changed.
Declaration
public event Action<Key> KeyChanged
Event Type
Type | Description |
---|---|
System.Action<Key> |
MouseFlagsChanged
Event invoked when the MouseFlags is changed.
Declaration
public event Action<MouseFlags> MouseFlagsChanged
Event Type
Type | Description |
---|---|
System.Action<MouseFlags> |
Implements
System.IDisposable