Class RadioGroup<T>
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
Non-visual coordination object for a set of RadioControl<T> — the single source of truth for which value is selected. Radios reference the group; the group enforces single-selection.
public sealed class RadioGroup<T>
Type Parameters
TThe value type each radio represents.
- Inheritance
-
RadioGroup<T>
- Inherited Members
- Extension Methods
Properties
AllowDeselect
Gets or sets a value indicating whether clicking the already-selected radio clears the selection. Only takes effect when Required is false (Required wins).
public bool AllowDeselect { get; set; }
Property Value
HasSelection
Gets a value indicating whether a value is currently selected.
public bool HasSelection { get; }
Property Value
Members
Gets the radios registered to this group, in registration order.
public IReadOnlyList<RadioControl<T>> Members { get; }
Property Value
Required
Gets or sets a value indicating whether the group cannot return to "none" once a value is selected (deselect and Clear() become no-ops while a selection exists). Does NOT force an initial selection.
public bool Required { get; set; }
Property Value
SelectedRadio
Gets the member whose Value equals the current selection, or null.
public RadioControl<T>? SelectedRadio { get; }
Property Value
- RadioControl<T>
SelectedValue
Gets or sets the currently selected value, or default(T)/none when nothing is selected.
Setting it updates the selection (honoring Required), repaints affected members,
and fires SelectionChanged once.
public T? SelectedValue { get; set; }
Property Value
- T
Methods
Clear()
Clears the selection to none. No-op when Required is true and a selection exists.
public void Clear()
Events
SelectionChanged
Occurs when the selected value changes.
public event EventHandler<T?>? SelectionChanged
Event Type
- EventHandler<T>
SelectionChangedAsync
Async counterpart of SelectionChanged.
public event AsyncEventHandler<T?>? SelectionChangedAsync