Table of Contents

Class MenuItem

Namespace
MiniTui
Assembly
MiniTui.dll

An item in a PopupMenu (1.x spec §7.2, §15.2).

public sealed record MenuItem : IEquatable<MenuItem>
Inheritance
MenuItem
Implements
Inherited Members

Constructors

MenuItem(string)

An item in a PopupMenu (1.x spec §7.2, §15.2).

public MenuItem(string Label)

Parameters

Label string

The text of the item. A single & marks the next character as the mnemonic ("&Save"); "&&" is a literal &, as is one before a space or at the end.

Properties

Checked

A check mark when true, an empty mark when false; null for an item without one. Default null.

public bool? Checked { get; init; }

Property Value

bool?

Enabled

A disabled item is drawn muted, skipped by the keys and not chosen by a click. True by default.

public bool Enabled { get; init; }

Property Value

bool

Hint

Display-only text drawn right-aligned and muted, such as a key: "Ctrl+S".

public string? Hint { get; init; }

Property Value

string

IsSeparator

True for Separator.

public bool IsSeparator { get; }

Property Value

bool

Label

The text of the item. A single & marks the next character as the mnemonic ("&Save"); "&&" is a literal &, as is one before a space or at the end.

public string Label { get; init; }

Property Value

string

Mnemonic

The mnemonic: the character after the first single & in Label, lowercase, or null.

public char? Mnemonic { get; }

Property Value

char?

Radio

Draw Checked as a radio mark (● or ○) instead of a check. Default false.

public bool Radio { get; init; }

Property Value

bool

Run

Run on the UI thread when the item is chosen, after the menu and every menu it was opened from have closed.

public Action? Run { get; init; }

Property Value

Action

Separator

A divider line. It is never selected or chosen.

public static MenuItem Separator { get; }

Property Value

MenuItem

Submenu

The items of a submenu, opened beside the item with → or Enter or a click (1.x spec §15.4), or null. An item with a submenu is never chosen itself, and its Hint isn't drawn.

public IReadOnlyList<MenuItem>? Submenu { get; init; }

Property Value

IReadOnlyList<MenuItem>