Skip to content

MenuItemWidget ​

Namespace: Hex1b.Widgets

Assembly: Hex1b.dll

A menu item that can be activated to trigger an action.

csharp
public sealed record MenuItemWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IMenuChild, IEquatable<MenuItemWidget>

Inheritance ​

Object → Hex1bWidget → MenuItemWidget

Implements ​

Constructors ​

A menu item that can be activated to trigger an action.

Parameters:

  • Label (String): The display label for the item.
csharp
public MenuItemWidget(string Label)

Properties ​

Label ​

The display label for the item.

Returns: String

csharp
public string Label { get; init; }

Methods ​

Disabled(bool) ​

Sets whether the item is disabled.

Parameters:

  • disabled (Boolean): True to disable the item.

Returns: MenuItemWidget

csharp
public MenuItemWidget Disabled(bool disabled = true)

NoAccelerator() ​

Disables automatic accelerator assignment for this item.

Returns: MenuItemWidget

csharp
public MenuItemWidget NoAccelerator()

OnActivated(Action<MenuItemActivatedEventArgs>) ​

Sets a synchronous handler called when the item is activated.

Parameters:

Returns: MenuItemWidget

csharp
public MenuItemWidget OnActivated(Action<MenuItemActivatedEventArgs> handler)

OnActivated(Func<MenuItemActivatedEventArgs, Task>) ​

Sets an asynchronous handler called when the item is activated.

Parameters:

Returns: MenuItemWidget

csharp
public MenuItemWidget OnActivated(Func<MenuItemActivatedEventArgs, Task> handler)

Fields ​

Activate ​

Rebindable action: Activate the menu item.

Returns: ActionId

csharp
public static readonly ActionId Activate

Close ​

Rebindable action: Close the menu.

Returns: ActionId

csharp
public static readonly ActionId Close

MoveDown ​

Rebindable action: Move to next item.

Returns: ActionId

csharp
public static readonly ActionId MoveDown

MoveUp ​

Rebindable action: Move to previous item.

Returns: ActionId

csharp
public static readonly ActionId MoveUp

Rebindable action: Navigate to previous menu.

Returns: ActionId

csharp
public static readonly ActionId NavigateLeft

Rebindable action: Navigate to next menu.

Returns: ActionId

csharp
public static readonly ActionId NavigateRight

Released under the MIT License.