RadioGroup class Core

A set of RadioButtons of which one is picked - an option group. The group owns the pick (RadioGroup.Selected, RadioGroup.Select); the arrows move the pick along the group and the focus with it, wrapping at the ends, and Tab enters the group at the picked button and leaves it with the next one - the group is one tab stop. For assistive technology it is a radio group holding its buttons, named by Control.AccessibleName.

Change RadioGroup.Selected's state on a shown board inside Board.Mutate; add buttons there too.

public sealed class RadioGroup : Control
Namespace
ArionUI.Presentation.Controls
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease
Inherits
Control

Constructors

RadioGroup

public RadioGroup();

Properties

Buttons

public IReadOnlyList<RadioButton> Buttons { get; }

The group's buttons, in order.

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.

Count

public int Count { get; }

How many buttons the group holds.

Gap

public double Gap { get; init; }

Space between two buttons.

Horizontal

public bool Horizontal { get; init; }

Lays the buttons out side by side instead of one under the other.

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.

Select

public required Action<int> Select { get; init; }

Picks the button at the index - a click, Space, an arrow or assistive technology.

Selected

public required Func<int> Selected { get; init; }

The index of the picked button; -1 for none.

Methods

Add

public RadioGroup Add(string text, string? id = null, Func<bool>? enabledWhen = null);

Adds a choice with a fixed caption.

Add

public RadioGroup Add(Func<string> text, string? id = null, Func<bool>? enabledWhen = null);

Adds a choice captioned text; id names its part (default: the group's id and its index), enabledWhen asks whether it can be picked now (null: always) - never while the group is disabled.

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.

Measure

public override LogSize Measure(LogSize available);

Desired size given the space available (layout containers sum this).

Render

public override void Render(IRenderSurface s, ControlFrame frame);