SegmentedControl class Core
A choice of a few options shown as segments side by side, one of them picked - "Sum | Count | Average". It composes a ChoiceGroup of ChoiceTiles of equal width, so picking, the arrows (to the next option that can be picked, wrapping), Tab and the reader are the group's.
Styling. From the style sheets: the track is the control's own box (Select.Type<SegmentedControl>(): background, border, corner radius, padding), the segments are tiles with the class segment (Select.Type<ChoiceTile>().Class("segment")). The theme draws a track in Tokens.SegmentTrack rounded by 8 with 2 units of padding, and the picked segment raised on the card fill with a small shadow and a border in Tokens.SegmentPickedBorder (the accent in the high-contrast themes, transparent elsewhere). Home and End pick the first and the last option that can be picked. The class outlined on the control makes the segments separate equal-width choices with a hairline border, the picked one in the accent's border and tint (the segments then carry segment outlined).
public sealed class SegmentedControl : Panel
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Panel
Constructors
SegmentedControl
public SegmentedControl();
Properties
Group
public ChoiceGroup Group { get; }The group of segments inside.
Height
public double Height { get; init; }The height the control asks for; NaN (the default) takes 32, outlined 34.
OptionEnabled
public Func<int, bool>? OptionEnabled { get; init; }Asks whether the option at the index can be picked now; null: all can.
Options
public required IReadOnlyList<LocalText> Options { get; init; }The options, in order.
Select
public required Action<int> Select { get; init; }Picks the option at the index.
Selected
public required Func<int> Selected { get; init; }The index of the picked option; -1 for none.
SizesToContent
public bool SizesToContent { get; init; }Whether the control asks for the width its widest option needs in every segment rather than all the width it is offered: a choice beside a label in a row, whose options read whole in every language.
Methods
Arrange
public override void Arrange(LogRect bounds);
EnsureChildren
protected override void EnsureChildren();A panel that builds its children when first asked (from init-only properties) does it here, through Panel.AddChild; called before every read of the children.
Measure
public override LogSize Measure(LogSize available);
Render
public override void Render(IRenderSurface s, ControlFrame frame);