This document captures design and implementation notes for RadioButton.
For end-user usage and examples, see RadioButton.
GroupBy value; when a radio button becomes checked, it unchecks other checked radios in the same group.RadioButton : Visual (sealed)RadioButton() sets Focusable = true.RadioButton(string text, object? groupBy = null, bool isChecked = false) convenience ctor:
Text, GroupBy, IsCheckedText : Visual?
string which becomes a TextBlock via implicit conversions/extensionsIsChecked : boolGroupBy : object?
width = labelWidth + 4 (glyph + space + label)height = 1x = finalRect.X + 2 with width clamped to available.Bounds.XBounds.X + 1 (when width allows)RadioButtonStyle.CheckedGlyph / UncheckedGlyph.Space / Enter: checks the radio button (if not already checked)._isPressed flagWhen the radio becomes checked:
GroupBy is null, no group behavior occurs.RadioButton instances where:
IsChecked == trueEquals(other.GroupBy, this.GroupBy)This is a simple retained-mode approach that avoids requiring a global registry; it assumes grouped radios are within the same visual tree.
Key knobs:
CheckedGlyph (default ◉)UncheckedGlyph (default ◯)Normal, Hovered, Focused, DisabledDefault resolution uses theme colors:
Theme.FocusBorder foreground (when available)Theme.Accent (when available)Theme.Disabled (when available)src/XenoAtom.Terminal.UI.Tests/RadioButtonTests.cssrc/XenoAtom.Terminal.UI.Tests/RadioButtonListTests.cs (the list control, see also RadioButtonList<T>)RadioGroup abstraction for cases where the visual-tree scan is too expensive or needs cross-tree grouping.