Table of Contents

Class ButtonBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for button controls

public sealed class ButtonBuilder
Inheritance
ButtonBuilder
Inherited Members

Methods

Build()

Builds the button control

public ButtonControl Build()

Returns

ButtonControl

The configured button control

Centered()

Centers the button

public ButtonBuilder Centered()

Returns

ButtonBuilder

The builder for chaining

Disabled()

Disables the button

public ButtonBuilder Disabled()

Returns

ButtonBuilder

The builder for chaining

Enabled(bool)

Sets the enabled state

public ButtonBuilder Enabled(bool enabled = true)

Parameters

enabled bool

Whether the button is enabled

Returns

ButtonBuilder

The builder for chaining

OnClick(WindowEventHandler<ButtonControl>)

Sets the click event handler with window access

public ButtonBuilder OnClick(WindowEventHandler<ButtonControl> handler)

Parameters

handler WindowEventHandler<ButtonControl>

Handler that receives sender, event data, and window

Returns

ButtonBuilder

The builder for chaining

OnClick(EventHandler<ButtonControl>)

Sets the click event handler

public ButtonBuilder OnClick(EventHandler<ButtonControl> handler)

Parameters

handler EventHandler<ButtonControl>

The click handler

Returns

ButtonBuilder

The builder for chaining

OnGotFocus(WindowEventHandler<EventArgs>)

Sets the GotFocus event handler with window access

public ButtonBuilder OnGotFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

ButtonBuilder

The builder for chaining

OnGotFocus(EventHandler)

Sets the GotFocus event handler

public ButtonBuilder OnGotFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler to invoke when the button receives focus

Returns

ButtonBuilder

The builder for chaining

OnLostFocus(WindowEventHandler<EventArgs>)

Sets the LostFocus event handler with window access

public ButtonBuilder OnLostFocus(WindowEventHandler<EventArgs> handler)

Parameters

handler WindowEventHandler<EventArgs>

Handler that receives sender, event data, and window

Returns

ButtonBuilder

The builder for chaining

OnLostFocus(EventHandler)

Sets the LostFocus event handler

public ButtonBuilder OnLostFocus(EventHandler handler)

Parameters

handler EventHandler

The event handler to invoke when the button loses focus

Returns

ButtonBuilder

The builder for chaining

StickyBottom()

Makes the control stick to the bottom of the window

public ButtonBuilder StickyBottom()

Returns

ButtonBuilder

The builder for chaining

StickyTop()

Makes the control stick to the top of the window

public ButtonBuilder StickyTop()

Returns

ButtonBuilder

The builder for chaining

Visible(bool)

Sets the visibility

public ButtonBuilder Visible(bool visible = true)

Parameters

visible bool

Whether the button is visible

Returns

ButtonBuilder

The builder for chaining

WithAlignment(HorizontalAlignment)

Sets the button alignment

public ButtonBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The alignment

Returns

ButtonBuilder

The builder for chaining

WithMargin(int)

Sets uniform margin

public ButtonBuilder WithMargin(int margin)

Parameters

margin int

The margin value for all sides

Returns

ButtonBuilder

The builder for chaining

WithMargin(int, int, int, int)

Sets the button margin

public ButtonBuilder 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

ButtonBuilder

The builder for chaining

WithName(string)

Sets the control name for lookup

public ButtonBuilder WithName(string name)

Parameters

name string

The control name

Returns

ButtonBuilder

The builder for chaining

WithStickyPosition(StickyPosition)

Sets the sticky position

public ButtonBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position

Returns

ButtonBuilder

The builder for chaining

WithTag(object)

Sets a tag object

public ButtonBuilder WithTag(object tag)

Parameters

tag object

The tag object

Returns

ButtonBuilder

The builder for chaining

WithText(string)

Sets the button text

public ButtonBuilder WithText(string text)

Parameters

text string

The button text

Returns

ButtonBuilder

The builder for chaining

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment

public ButtonBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment

Returns

ButtonBuilder

The builder for chaining

WithWidth(int)

Sets the button width

public ButtonBuilder WithWidth(int width)

Parameters

width int

The button width

Returns

ButtonBuilder

The builder for chaining

Operators

implicit operator ButtonControl(ButtonBuilder)

Implicit conversion to ButtonControl

public static implicit operator ButtonControl(ButtonBuilder builder)

Parameters

builder ButtonBuilder

The builder

Returns

ButtonControl

The built button control