MenuRow class Core
One command row of a menu-like surface (the filter dialog's chrome, menu entries, chooser rows, the command rows of a settings pane). Inherent: the hover row and the keyboard focus are the SAME visual (the shared row highlight — the keyboard cursor never invents its own), click and Space/Enter call the SAME endpoint, and a disabled row drops out of the tab order through its Control.EnabledWhen probe. The row's CONTENT is either painted by a delegate (MenuRow.DrawContent) or, without one, the row's own: a leading MenuRow.Badge or MenuRow.Icon, the label with an optional MenuRow.Detail line under it, and at the end a check mark (MenuRow.Checked) or a submenu arrow (MenuRow.ShowsChevron).
Styling. The own content takes the label's colour, size and weight from the style sheets (Select.Type<MenuRow>()): the theme draws 13 units in the text colour, faint while disabled; the class danger draws label and icon in the error colour. A label over a detail line is semibold; the detail is one unit smaller, dim. The icon is drawn in the dim text colour, the check mark in the accent.
public sealed class MenuRow : Control
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Control
Constructors
MenuRow
public MenuRow();
Properties
Activate
public required Action<LogRect> Activate { get; init; }The one endpoint — pointer and Space/Enter both call it. Receives the row's rect so a submenu can anchor where the row is.
ActivateOnPress
public bool ActivateOnPress { get; init; }True (default): the row acts on the press, like the filter dialog's chrome always has. False: arm on press, act on release-over (native menus).
Badge
public TypeBadge? Badge { get; init; }A badge before the label instead of an icon (an icon tile); null for none.
Checked
public Func<bool>? Checked { get; init; }Whether a check mark shows at the end (the option in effect); null for never.
Children
public override IEnumerable<Control> Children { get; }The controls inside this one, in tree order (visual order, tab order). A host keeps the tree it adopted: a control whose children change once it is adopted says so with Control.TreeChanged (on a shown board inside Board.Mutate), or its new children get no host and Tab, ticks and the wheel do not find them.
Detail
public Func<string>? Detail { get; init; }A second line under the label ("2 rows · 1 column"); null for none.
DrawContent
public Action<IRenderSurface, LogRect>? DrawContent { get; init; }Paints icon + label + markers into the row. Hover/focus highlight and the focus ring are drawn by the control BEFORE this runs. Null draws the row's own content (badge or icon, label, detail, check mark or arrow).
DrawsOwnFocus
public override bool DrawsOwnFocus { get; }The control shows its focus itself (accent border, hover row, ring parameter). False = the host draws the shared default ring around Control.Bounds.
Focusable
public override bool Focusable { get; }Can this KIND of control hold the keyboard focus? Combined with the live probes in Control.CanTakeFocus.
Height
public double Height { get; init; }The height the row asks for; NaN (the default) takes 36, or 52 with a MenuRow.Detail.
Icon
public Action<IRenderSurface, LogRect, Rgba>? Icon { get; init; }An icon before the label, drawn into a 16 unit box; null for none.
Label
public required Func<string> Label { get; init; }
Role
public override ControlRole Role { get; }What KIND of part this is for assistive technology — the automation peers translate it into their host's control type.
ShowsChevron
public bool ShowsChevron { get; init; }Shows the submenu arrow at the end: the row opens something further.
ToggleState
public override bool? ToggleState { get; }The checked state of a toggle part; null when the part does not toggle.
Methods
Arrange
public override void Arrange(LogRect bounds);
HitTest
public override Control? HitTest(LogPoint p);The control under an ABSOLUTE point, or null. Containers recurse; leaves answer for themselves. Same bounds the render pass used.
Invoke
public override bool Invoke();Anchors a submenu at the row's box — meaningful only once the pane is arranged, which is the case for every part a peer can see.
Measure
public override LogSize Measure(LogSize available);Desired size given the space available (layout containers sum this).
OnActivate
protected internal override void OnActivate();A click: the pointer went down on this control and came up over it again. The host calls it after Control.OnPointerReleased - not after a drag, a cancelled gesture or a release elsewhere, and not while the control is disabled or hidden. The one place a control acts on a click.
OnKey
public override bool OnKey(ArionKey key, ArionModifiers mods);Keys while focused. Return false to let the pane's fallback see the key.
OnPointerPressed
public override void OnPointerPressed(LogPoint p, ArionModifiers mods, int clickCount);
Render
public override void Render(IRenderSurface s, ControlFrame frame);
SpokenLabel
public override string? SpokenLabel();What a screen reader speaks when this control receives the focus. A control that cannot take the focus but answers here is READ: it becomes a text part.