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
titlestringThe title displayed in the tab header
contentIWindowControlThe 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
titlestringThe title displayed in the tab header
contentBuilderFunc<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
conditionboolWhether to add the tab
titlestringThe title displayed in the tab header
contentIWindowControlThe 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
conditionboolWhether to add the tab
titlestringThe title displayed in the tab header
contentBuilderFunc<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
visibleboolTrue if visible
Returns
- TabControlBuilder
The builder for chaining
WithActiveTab(int)
Sets the initially active tab index (0-based)
public TabControlBuilder WithActiveTab(int index)
Parameters
indexintThe 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
alignmentHorizontalAlignmentThe alignment
Returns
- TabControlBuilder
The builder for chaining
WithBackgroundColor(Color)
Sets the background color
public TabControlBuilder WithBackgroundColor(Color color)
Parameters
colorColorThe background color
Returns
- TabControlBuilder
The builder for chaining
WithForegroundColor(Color)
Sets the foreground color
public TabControlBuilder WithForegroundColor(Color color)
Parameters
colorColorThe foreground color
Returns
- TabControlBuilder
The builder for chaining
WithHeaderStyle(TabHeaderStyle)
Sets the header style for the tab control
public TabControlBuilder WithHeaderStyle(TabHeaderStyle style)
Parameters
styleTabHeaderStyleThe 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
heightintThe height in lines (minimum 2)
Returns
- TabControlBuilder
The builder for chaining
WithMargin(Margin)
Sets the margin
public TabControlBuilder WithMargin(Margin margin)
Parameters
marginMarginThe margin
Returns
- TabControlBuilder
The builder for chaining
WithMargin(int)
Sets uniform margin on all sides
public TabControlBuilder WithMargin(int margin)
Parameters
marginintThe 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
Returns
- TabControlBuilder
The builder for chaining
WithName(string)
Sets the control name
public TabControlBuilder WithName(string name)
Parameters
namestringThe control name
Returns
- TabControlBuilder
The builder for chaining
WithStickyPosition(StickyPosition)
Sets the sticky position
public TabControlBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPositionThe sticky position
Returns
- TabControlBuilder
The builder for chaining
WithTag(object)
Sets a tag object
public TabControlBuilder WithTag(object tag)
Parameters
tagobjectThe tag object
Returns
- TabControlBuilder
The builder for chaining
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment
public TabControlBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignmentThe vertical alignment
Returns
- TabControlBuilder
The builder for chaining
WithWidth(int)
Sets the width of the tab control
public TabControlBuilder WithWidth(int width)
Parameters
widthintThe 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
builderTabControlBuilder