Show / Hide Table of Contents

# Class MenuBarItem

A MenuBarItem contains MenuBarItems or MenuItems.

##### Inheritance

System.Object
MenuItem
MenuBarItem

##### Inherited Members

MenuItem.HotKey
MenuItem.ShortCut
MenuItem.Title
MenuItem.Help
MenuItem.Action
MenuItem.CanExecute
MenuItem.IsEnabled()
MenuItem.Checked
MenuItem.CheckType
MenuItem.Parent
MenuItem.GetMenuItem()
MenuItem.GetMenuBarItem()
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 class MenuBarItem : MenuItem

### Constructors

#### MenuBarItem()

Initializes a new MenuBarItem.

##### Declaration

    public MenuBarItem()

#### MenuBarItem(ustring, ustring, Action, Func<Boolean>, MenuItem)

Initializes a new MenuBarItem as a MenuItem.

##### Declaration

    public MenuBarItem(ustring title, ustring help, Action action, Func<bool> canExecute = null, MenuItem parent = null)

##### Parameters

Type | Name | Description
--- | --- | ---
NStack.ustring | title | Title for the menu item.
NStack.ustring | help | Help text to display.
System.Action | action | Action to invoke when the menu item is activated.
System.Func<System.Boolean> | canExecute | Function to determine if the action can currently be executed.
MenuItem | parent | The parent MenuItem of this if exist, otherwise is null.

#### MenuBarItem(ustring, MenuItem[], MenuItem)

Initializes a new MenuBarItem.

##### Declaration

    public MenuBarItem(ustring title, MenuItem[] children, MenuItem parent = null)

##### Parameters

Type | Name | Description
--- | --- | ---
NStack.ustring | title | Title for the menu item.
MenuItem[] | children | The items in the current menu.
MenuItem | parent | The parent MenuItem of this if exist, otherwise is null.

#### MenuBarItem(MenuItem[])

Initializes a new MenuBarItem.

##### Declaration

    public MenuBarItem(MenuItem[] children)

##### Parameters

Type | Name | Description
--- | --- | ---
MenuItem[] | children | The items in the current menu.

### Properties

#### Children

Gets or sets an array of MenuItem objects that are the children of this MenuBarItem

##### Declaration

    public MenuItem[] Children { get; set; }

##### Property Value

Type | Description
--- | ---
MenuItem[] | The children.

### Methods

#### GetChildrenIndex(MenuItem)

Get the index of the MenuItem parameter.

##### Declaration

    public int GetChildrenIndex(MenuItem children)

##### Parameters

Type | Name | Description
--- | --- | ---
MenuItem | children |

##### Returns

Type | Description
--- | ---
System.Int32 | Returns a value bigger than -1 if the MenuItem is a child of this.

#### IsSubMenuOf(MenuItem)

Check if the MenuItem parameter is a child of this.

##### Declaration

    public bool IsSubMenuOf(MenuItem menuItem)

##### Parameters

Type | Name | Description
--- | --- | ---
MenuItem | menuItem |

##### Returns

Type | Description
--- | ---
System.Boolean | Returns `true` if it is a child of this. `false` otherwise.

#### SubMenu(MenuItem)

Check if the children parameter is a MenuBarItem.

##### Declaration

    public MenuBarItem SubMenu(MenuItem children)

##### Parameters

Type | Name | Description
--- | --- | ---
MenuItem | children |

##### Returns

Type | Description
--- | ---
MenuBarItem | Returns a MenuBarItem or null otherwise.