Table of Contents

Class RadioBuilder<T>

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for RadioControl<T>.

public sealed class RadioBuilder<T> : IControlBuilder<RadioControl<T>>

Type Parameters

T

The value type this radio represents.

Inheritance
RadioBuilder<T>
Implements
Inherited Members
Extension Methods

Constructors

RadioBuilder(RadioGroup<T>, T, string)

Initializes a new RadioBuilder<T> for the given group and value.

public RadioBuilder(RadioGroup<T> group, T value, string label = "")

Parameters

group RadioGroup<T>

The coordinating group.

value T

The value this radio represents.

label string

The text label displayed next to the radio.

Methods

Build()

Builds and returns a configured RadioControl<T>.

public RadioControl<T> Build()

Returns

RadioControl<T>

Outline(bool)

Renders the radio in outline style (role colour on text, surface fill).

public RadioBuilder<T> Outline(bool outline = true)

Parameters

outline bool

Whether to use outline style.

Returns

RadioBuilder<T>

The builder for chaining.

Selected()

Marks this radio as the initially selected option. In Build(), the group's SelectedValue is set to this radio's value.

public RadioBuilder<T> Selected()

Returns

RadioBuilder<T>

The builder for chaining.

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment of the radio within its allocated space.

public RadioBuilder<T> WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The horizontal alignment.

Returns

RadioBuilder<T>

The builder for chaining.

WithColorRole(ColorRole, ThemeMode?)

Sets the control's semantic colour role.

public RadioBuilder<T> WithColorRole(ColorRole role, ThemeMode? mode = null)

Parameters

role ColorRole

The semantic role determining the radio's colours.

mode ThemeMode?

Optional ThemeMode override. When null, the active theme's mode is used.

Returns

RadioBuilder<T>

The builder for chaining.

WithLabel(string)

Sets the label text displayed next to the radio.

public RadioBuilder<T> WithLabel(string label)

Parameters

label string

The label text.

Returns

RadioBuilder<T>

The builder for chaining.

WithMargin(int)

Sets a uniform margin on all sides.

public RadioBuilder<T> WithMargin(int margin)

Parameters

margin int

The margin value.

Returns

RadioBuilder<T>

The builder for chaining.

WithMargin(int, int, int, int)

Sets the margin around the control.

public RadioBuilder<T> WithMargin(int left, int top, int right, int bottom)

Parameters

left int

Left margin.

top int

Top margin.

right int

Right margin.

bottom int

Bottom margin.

Returns

RadioBuilder<T>

The builder for chaining.

WithName(string)

Sets the control name for programmatic lookup.

public RadioBuilder<T> WithName(string name)

Parameters

name string

The control name.

Returns

RadioBuilder<T>

The builder for chaining.

WithSelectedCharacter(string)

Sets the character displayed when this radio is selected (default "●").

public RadioBuilder<T> WithSelectedCharacter(string character)

Parameters

character string

The selected character.

Returns

RadioBuilder<T>

The builder for chaining.

WithUnselectedCharacter(string)

Sets the character displayed when this radio is unselected (default "○").

public RadioBuilder<T> WithUnselectedCharacter(string character)

Parameters

character string

The unselected character.

Returns

RadioBuilder<T>

The builder for chaining.

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment of the radio within its allocated space.

public RadioBuilder<T> WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment.

Returns

RadioBuilder<T>

The builder for chaining.

Wrap(bool)

Enables or disables label wrapping across lines.

public RadioBuilder<T> Wrap(bool wrap = true)

Parameters

wrap bool

Whether to wrap the label.

Returns

RadioBuilder<T>

The builder for chaining.

Operators

implicit operator RadioControl<T>(RadioBuilder<T>)

Implicit conversion to RadioControl<T>.

public static implicit operator RadioControl<T>(RadioBuilder<T> builder)

Parameters

builder RadioBuilder<T>

Returns

RadioControl<T>