MenuItemWidget
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
A menu item that can be activated to trigger an action.
public sealed record MenuItemWidget : Hex1bWidget, IEquatable<Hex1bWidget>, IMenuChild, IEquatable<MenuItemWidget>Inheritance
Object → Hex1bWidget → MenuItemWidget
Implements
Constructors
MenuItemWidget(string)
A menu item that can be activated to trigger an action.
Parameters:
Label(String): The display label for the item.
public MenuItemWidget(string Label)Properties
Label
The display label for the item.
Returns: String
public string Label { get; init; }Methods
Disabled(bool)
Sets whether the item is disabled.
Parameters:
disabled(Boolean): True to disable the item.
Returns: MenuItemWidget
public MenuItemWidget Disabled(bool disabled = true)NoAccelerator()
Disables automatic accelerator assignment for this item.
Returns: MenuItemWidget
public MenuItemWidget NoAccelerator()OnActivated(Action<MenuItemActivatedEventArgs>)
Sets a synchronous handler called when the item is activated.
Parameters:
handler(Action<MenuItemActivatedEventArgs>):
Returns: MenuItemWidget
public MenuItemWidget OnActivated(Action<MenuItemActivatedEventArgs> handler)OnActivated(Func<MenuItemActivatedEventArgs, Task>)
Sets an asynchronous handler called when the item is activated.
Parameters:
handler(Func<MenuItemActivatedEventArgs, Task>):
Returns: MenuItemWidget
public MenuItemWidget OnActivated(Func<MenuItemActivatedEventArgs, Task> handler)Fields
Activate
Rebindable action: Activate the menu item.
Returns: ActionId
public static readonly ActionId ActivateClose
Rebindable action: Close the menu.
Returns: ActionId
public static readonly ActionId CloseMoveDown
Rebindable action: Move to next item.
Returns: ActionId
public static readonly ActionId MoveDownMoveUp
Rebindable action: Move to previous item.
Returns: ActionId
public static readonly ActionId MoveUpNavigateLeft
Rebindable action: Navigate to previous menu.
Returns: ActionId
public static readonly ActionId NavigateLeftNavigateRight
Rebindable action: Navigate to next menu.
Returns: ActionId
public static readonly ActionId NavigateRight