MenuContext
Namespace: Hex1b.Widgets
Assembly: Hex1b.dll
Provides a fluent API context for building menu structures. This context exposes only menu-related methods (Menu, MenuItem, Separator) to guide developers toward the correct API usage.
csharp
public readonly struct MenuContextMethods
Menu(string, Func<MenuContext, IEnumerable<IMenuChild>>)
Creates a submenu with the specified label and children.
Parameters:
label(String): The menu label. Use & before a character to specify an explicit accelerator (e.g., "&File").children(Func<MenuContext, IMenuChild>>): A function that returns the menu children.
Returns: MenuWidget
A MenuWidget configured with the specified label and children.
csharp
public MenuWidget Menu(string label, Func<MenuContext, IEnumerable<IMenuChild>> children)MenuItem(string)
Creates a menu item with the specified label.
Parameters:
label(String): The item label. Use & before a character to specify an explicit accelerator (e.g., "&Open").
Returns: MenuItemWidget
A MenuItemWidget configured with the specified label.
csharp
public MenuItemWidget MenuItem(string label)Separator()
Creates a menu separator.
Returns: MenuSeparatorWidget
A MenuSeparatorWidget.
csharp
public MenuSeparatorWidget Separator()