MenuItem record Core
One row of a MenuOverlayContent: a clickable entry (optionally check-marked / disabled / danger) or a separator. MenuItem.Icon draws in the left gutter when the entry is NOT checked (e.g. the operator glyph); a checked entry shows a ✓ there instead — same as the classic menu. MenuItem.ClosesMenu (default true) decides whether picking the entry also dismisses the menu — set it false for entries you keep clicking (toggles, an option you want to compare), so the dev owns that behaviour per entry. MenuItem.Shortcut is the key that does the same ("Ctrl+C"), shown right-aligned and dimmed - display only, the key itself belongs to whoever handles it. MenuItem.OpenSubMenuAt makes the entry a submenu trigger: picking it (click, Enter, Right) hands over the entry's row in pane coordinates, the anchor the host's OpenSubmenu takes, and the menu stays open beneath the submenu.
public sealed record MenuItem
- Namespace
- ArionUI.Presentation.Overlay
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease
Constructors
MenuItem
public MenuItem(string Label, Action? OnClick = null, bool? Checked = default, bool Enabled = true, bool IsSeparator = false, Action<IRenderSurface, LogRect, Rgba>? Icon = null, bool Danger = false, bool ClosesMenu = true, Func<bool>? LiveChecked = null, bool OpensSubMenu = false, string? Shortcut = null, Action<LogRect>? OpenSubMenuAt = null);One row of a MenuOverlayContent: a clickable entry (optionally check-marked / disabled / danger) or a separator. MenuItem.Icon draws in the left gutter when the entry is NOT checked (e.g. the operator glyph); a checked entry shows a ✓ there instead — same as the classic menu. MenuItem.ClosesMenu (default true) decides whether picking the entry also dismisses the menu — set it false for entries you keep clicking (toggles, an option you want to compare), so the dev owns that behaviour per entry. MenuItem.Shortcut is the key that does the same ("Ctrl+C"), shown right-aligned and dimmed - display only, the key itself belongs to whoever handles it. MenuItem.OpenSubMenuAt makes the entry a submenu trigger: picking it (click, Enter, Right) hands over the entry's row in pane coordinates, the anchor the host's OpenSubmenu takes, and the menu stays open beneath the submenu.
Properties
Checked
public bool? Checked { get; init; }
CheckedNow
public bool? CheckedNow { get; }Check state at DRAW time: MenuItem.LiveChecked wins over the static MenuItem.Checked, so an entry that toggles engine state shows the truth without the menu being rebuilt (the legacy MenuEntry had exactly this).
ClosesMenu
public bool ClosesMenu { get; init; }
Danger
public bool Danger { get; init; }
Enabled
public bool Enabled { get; init; }
Icon
public Action<IRenderSurface, LogRect, Rgba>? Icon { get; init; }
IsSeparator
public bool IsSeparator { get; init; }
Label
public string Label { get; init; }
LiveChecked
public Func<bool>? LiveChecked { get; init; }
OnClick
public Action? OnClick { get; init; }
OpensSubMenu
public bool OpensSubMenu { get; init; }
OpenSubMenuAt
public Action<LogRect>? OpenSubMenuAt { get; init; }
Shortcut
public string? Shortcut { get; init; }
Methods
Separator
public static MenuItem Separator();