Table of Contents

Class TabControlBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for tab controls

public sealed class TabControlBuilder : IControlBuilder<TabControl>
Inheritance
TabControlBuilder
Implements
Inherited Members
Extension Methods

Methods

AddTab(string, IWindowControl)

Adds a new tab to the control

public TabControlBuilder AddTab(string title, IWindowControl content)

Parameters

title string

The title displayed in the tab header

content IWindowControl

The control to display when this tab is active

Returns

TabControlBuilder

The builder for chaining

AddTab(string, Func<IWindowControl>)

Adds a new tab using a builder function

public TabControlBuilder AddTab(string title, Func<IWindowControl> contentBuilder)

Parameters

title string

The title displayed in the tab header

contentBuilder Func<IWindowControl>

A function that builds the tab content

Returns

TabControlBuilder

The builder for chaining

AddTabIf(bool, string, IWindowControl)

Adds a tab only if the condition is true

public TabControlBuilder AddTabIf(bool condition, string title, IWindowControl content)

Parameters

condition bool

Whether to add the tab

title string

The title displayed in the tab header

content IWindowControl

The control to display when this tab is active

Returns

TabControlBuilder

The builder for chaining

AddTabIf(bool, string, Func<IWindowControl>)

Adds a tab only if the condition is true, using a builder function

public TabControlBuilder AddTabIf(bool condition, string title, Func<IWindowControl> contentBuilder)

Parameters

condition bool

Whether to add the tab

title string

The title displayed in the tab header

contentBuilder Func<IWindowControl>

A function that builds the tab content

Returns

TabControlBuilder

The builder for chaining

AddTabs(params (string title, IWindowControl content)[])

Adds multiple tabs at once

public TabControlBuilder AddTabs(params (string title, IWindowControl content)[] tabs)

Parameters

tabs (string title, IWindowControl content)[]

Tuples of (title, content) for each tab

Returns

TabControlBuilder

The builder for chaining

Build()

Builds the tab control

public TabControl Build()

Returns

TabControl

The configured TabControl

Centered()

Centers the control horizontally

public TabControlBuilder Centered()

Returns

TabControlBuilder

The builder for chaining

Fill()

Makes the control fill the available vertical space

public TabControlBuilder Fill()

Returns

TabControlBuilder

The builder for chaining

StickyBottom()

Makes the control stick to the bottom of the window

public TabControlBuilder StickyBottom()

Returns

TabControlBuilder

The builder for chaining

StickyTop()

Makes the control stick to the top of the window

public TabControlBuilder StickyTop()

Returns

TabControlBuilder

The builder for chaining

Visible(bool)

Sets the visibility

public TabControlBuilder Visible(bool visible = true)

Parameters

visible bool

True if visible

Returns

TabControlBuilder

The builder for chaining

WithActiveTab(int)

Sets the initially active tab index (0-based)

public TabControlBuilder WithActiveTab(int index)

Parameters

index int

The index of the tab to activate initially

Returns

TabControlBuilder

The builder for chaining

WithAlignment(HorizontalAlignment)

Sets the horizontal alignment

public TabControlBuilder WithAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

The alignment

Returns

TabControlBuilder

The builder for chaining

WithBackgroundColor(Color)

Sets the background color

public TabControlBuilder WithBackgroundColor(Color color)

Parameters

color Color

The background color

Returns

TabControlBuilder

The builder for chaining

WithForegroundColor(Color)

Sets the foreground color

public TabControlBuilder WithForegroundColor(Color color)

Parameters

color Color

The foreground color

Returns

TabControlBuilder

The builder for chaining

WithHeaderStyle(TabHeaderStyle)

Sets the header style for the tab control

public TabControlBuilder WithHeaderStyle(TabHeaderStyle style)

Parameters

style TabHeaderStyle

The header style to use

Returns

TabControlBuilder

The builder for chaining

WithHeight(int)

Sets the height of the tab control

public TabControlBuilder WithHeight(int height)

Parameters

height int

The height in lines (minimum 2)

Returns

TabControlBuilder

The builder for chaining

WithMargin(Margin)

Sets the margin

public TabControlBuilder WithMargin(Margin margin)

Parameters

margin Margin

The margin

Returns

TabControlBuilder

The builder for chaining

WithMargin(int)

Sets uniform margin on all sides

public TabControlBuilder WithMargin(int margin)

Parameters

margin int

The margin value

Returns

TabControlBuilder

The builder for chaining

WithMargin(int, int, int, int)

Sets the margin

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

TabControlBuilder

The builder for chaining

WithName(string)

Sets the control name

public TabControlBuilder WithName(string name)

Parameters

name string

The control name

Returns

TabControlBuilder

The builder for chaining

WithStickyPosition(StickyPosition)

Sets the sticky position

public TabControlBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

The sticky position

Returns

TabControlBuilder

The builder for chaining

WithTag(object)

Sets a tag object

public TabControlBuilder WithTag(object tag)

Parameters

tag object

The tag object

Returns

TabControlBuilder

The builder for chaining

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment

public TabControlBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

The vertical alignment

Returns

TabControlBuilder

The builder for chaining

WithWidth(int)

Sets the width of the tab control

public TabControlBuilder WithWidth(int width)

Parameters

width int

The width in characters

Returns

TabControlBuilder

The builder for chaining

Operators

implicit operator TabControl(TabControlBuilder)

Implicit conversion to TabControl

public static implicit operator TabControl(TabControlBuilder builder)

Parameters

builder TabControlBuilder

Returns

TabControl