Class RadioGroupBuilder<T>
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for RadioGroup<T> — the non-visual coordination object that owns the single-selection invariant for a set of RadioControl<T> instances.
public sealed class RadioGroupBuilder<T>
Type Parameters
TThe value type each radio in the group represents.
- Inheritance
-
RadioGroupBuilder<T>
- Inherited Members
- Extension Methods
Methods
AllowDeselect(bool)
Allows clicking the already-selected radio to clear the selection. Only takes effect when Required(bool) is false (Required wins).
public RadioGroupBuilder<T> AllowDeselect(bool allow = true)
Parameters
allowboolWhether to allow deselecting.
Returns
- RadioGroupBuilder<T>
The builder for chaining.
Build()
Builds and returns a configured RadioGroup<T>.
public RadioGroup<T> Build()
Returns
- RadioGroup<T>
OnSelectionChanged(Action<T?>)
Subscribes to the SelectionChanged event in Build().
public RadioGroupBuilder<T> OnSelectionChanged(Action<T?> handler)
Parameters
handlerAction<T>The action to invoke when the selection changes.
Returns
- RadioGroupBuilder<T>
The builder for chaining.
Required(bool)
Prevents the group from returning to "none" once a value is selected.
public RadioGroupBuilder<T> Required(bool required = true)
Parameters
requiredboolWhether selection is required.
Returns
- RadioGroupBuilder<T>
The builder for chaining.
WithSelectedValue(T)
Sets the initial selected value of the group.
public RadioGroupBuilder<T> WithSelectedValue(T value)
Parameters
valueTThe value to pre-select.
Returns
- RadioGroupBuilder<T>
The builder for chaining.