Class CheckboxBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for checkbox controls
public sealed class CheckboxBuilder : IControlBuilder<CheckboxControl>
- Inheritance
-
CheckboxBuilder
- Implements
- Inherited Members
- Extension Methods
Methods
Build()
Builds the checkbox control
public CheckboxControl Build()
Returns
Checked(bool)
Sets the checked state
public CheckboxBuilder Checked(bool isChecked = true)
Parameters
isCheckedbool
Returns
OnCheckedChanged(WindowEventHandler<bool>)
Sets the checked changed event handler with window access
public CheckboxBuilder OnCheckedChanged(WindowEventHandler<bool> handler)
Parameters
handlerWindowEventHandler<bool>
Returns
OnCheckedChanged(EventHandler<bool>)
Sets the checked changed event handler
public CheckboxBuilder OnCheckedChanged(EventHandler<bool> handler)
Parameters
handlerEventHandler<bool>
Returns
OnGotFocus(WindowEventHandler<EventArgs>)
Sets the GotFocus event handler with window access
public CheckboxBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- CheckboxBuilder
The builder for chaining
OnGotFocus(EventHandler)
Sets the GotFocus event handler
public CheckboxBuilder OnGotFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the checkbox receives focus
Returns
- CheckboxBuilder
The builder for chaining
OnLostFocus(WindowEventHandler<EventArgs>)
Sets the LostFocus event handler with window access
public CheckboxBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)
Parameters
handlerWindowEventHandler<EventArgs>Handler that receives sender, event data, and window
Returns
- CheckboxBuilder
The builder for chaining
OnLostFocus(EventHandler)
Sets the LostFocus event handler
public CheckboxBuilder OnLostFocus(EventHandler handler)
Parameters
handlerEventHandlerThe event handler to invoke when the checkbox loses focus
Returns
- CheckboxBuilder
The builder for chaining
Outline(bool)
Renders the checkbox in outline style (role colour on text, surface fill).
public CheckboxBuilder Outline(bool outline = true)
Parameters
outlineboolWhether to use outline style.
Returns
- CheckboxBuilder
The builder for chaining
StickyBottom()
Makes the control stick to the bottom of the window
public CheckboxBuilder StickyBottom()
Returns
StickyTop()
Makes the control stick to the top of the window
public CheckboxBuilder StickyTop()
Returns
Visible(bool)
Sets the visibility
public CheckboxBuilder Visible(bool visible = true)
Parameters
visiblebool
Returns
WithAlignment(HorizontalAlignment)
Sets the horizontal alignment
public CheckboxBuilder WithAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithCheckedCharacter(string)
Sets the character displayed inside the checkbox when checked (default "X"). Use any single visible character such as "✓", "✗", or "●".
public CheckboxBuilder WithCheckedCharacter(string character)
Parameters
characterstring
Returns
WithCheckmark(string, string)
Sets both the checked and unchecked characters in a single call.
public CheckboxBuilder WithCheckmark(string checkedCharacter, string uncheckedCharacter = " ")
Parameters
Returns
WithColorRole(ColorRole, ThemeMode?)
Sets the control's semantic colour role.
public CheckboxBuilder WithColorRole(ColorRole role, ThemeMode? mode = null)
Parameters
roleColorRoleThe semantic role determining the checkbox's colours.
modeThemeMode?Optional ThemeMode override for dark/light role-colour derivation. When null, the active theme's mode is used.
Returns
- CheckboxBuilder
The builder for chaining
WithLabel(string)
Sets the checkbox label
public CheckboxBuilder WithLabel(string label)
Parameters
labelstring
Returns
WithMargin(int)
Sets uniform margin
public CheckboxBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int, int, int)
Sets the margin
public CheckboxBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name for lookup
public CheckboxBuilder WithName(string name)
Parameters
namestring
Returns
WithStickyPosition(StickyPosition)
Sets the sticky position
public CheckboxBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPosition
Returns
WithTag(object)
Sets a tag object
public CheckboxBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithUncheckedCharacter(string)
Sets the character displayed inside the checkbox when unchecked (default " ").
public CheckboxBuilder WithUncheckedCharacter(string character)
Parameters
characterstring
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public CheckboxBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithWidth(int)
Sets the width
public CheckboxBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator CheckboxControl(CheckboxBuilder)
Implicit conversion to CheckboxControl
public static implicit operator CheckboxControl(CheckboxBuilder builder)
Parameters
builderCheckboxBuilder