Class TableControlBuilder
- Namespace
- SharpConsoleUI.Builders
- Assembly
- SharpConsoleUI.dll
Fluent builder for creating TableControl instances with comprehensive configuration.
public sealed class TableControlBuilder
- Inheritance
-
TableControlBuilder
- Inherited Members
Methods
AddColumn(TableColumn)
Adds a custom column to the table.
public TableControlBuilder AddColumn(TableColumn column)
Parameters
columnTableColumn
Returns
AddColumn(string, Justify, int?)
Adds a column to the table.
public TableControlBuilder AddColumn(string header, Justify alignment = Justify.Left, int? width = null)
Parameters
Returns
AddRow(TableRow)
Adds a custom row to the table.
public TableControlBuilder AddRow(TableRow row)
Parameters
rowTableRow
Returns
AddRow(params string[])
Adds a row with the specified cells.
public TableControlBuilder AddRow(params string[] cells)
Parameters
cellsstring[]
Returns
AlignBottom()
Aligns the table to the bottom vertically.
public TableControlBuilder AlignBottom()
Returns
Build()
Builds the TableControl with all configured options.
public TableControl Build()
Returns
CenterHorizontal()
Centers the table horizontally.
public TableControlBuilder CenterHorizontal()
Returns
CenterVertical()
Centers the table vertically.
public TableControlBuilder CenterVertical()
Returns
Centered()
Centers the table horizontally and vertically.
public TableControlBuilder Centered()
Returns
DoubleLine()
Uses double-line border style.
public TableControlBuilder DoubleLine()
Returns
DoubleLineBorder()
Uses double-line border style.
public TableControlBuilder DoubleLineBorder()
Returns
Hidden()
Hides the table.
public TableControlBuilder Hidden()
Returns
HideHeader()
Hides the header row.
public TableControlBuilder HideHeader()
Returns
NoBorder()
Uses no border.
public TableControlBuilder NoBorder()
Returns
Rounded()
Uses rounded border style.
public TableControlBuilder Rounded()
Returns
ShowHeader(bool)
Shows or hides the header row.
public TableControlBuilder ShowHeader(bool show = true)
Parameters
showbool
Returns
ShowRowSeparators(bool)
Shows or hides row separators.
public TableControlBuilder ShowRowSeparators(bool show = true)
Parameters
showbool
Returns
SingleLine()
Uses single-line border style.
public TableControlBuilder SingleLine()
Returns
StickyBottom()
Makes the table stick to the bottom during scrolling.
public TableControlBuilder StickyBottom()
Returns
StickyTop()
Makes the table stick to the top during scrolling.
public TableControlBuilder StickyTop()
Returns
StretchHorizontal()
Stretches the table horizontally to fill available width.
public TableControlBuilder StretchHorizontal()
Returns
WithBackgroundColor(Color)
Sets the background color.
public TableControlBuilder WithBackgroundColor(Color color)
Parameters
colorColor
Returns
WithBorderColor(Color)
Sets the border color.
public TableControlBuilder WithBorderColor(Color color)
Parameters
colorColor
Returns
WithBorderStyle(BorderStyle)
Sets the border style.
public TableControlBuilder WithBorderStyle(BorderStyle style)
Parameters
styleBorderStyle
Returns
WithColors(Color, Color)
Sets both foreground and background colors.
public TableControlBuilder WithColors(Color foreground, Color background)
Parameters
foregroundColorbackgroundColor
Returns
WithColumns(params string[])
Adds multiple columns from header names.
public TableControlBuilder WithColumns(params string[] headers)
Parameters
headersstring[]
Returns
WithForegroundColor(Color)
Sets the foreground (text) color.
public TableControlBuilder WithForegroundColor(Color color)
Parameters
colorColor
Returns
WithHeaderColors(Color, Color)
Sets the header colors.
public TableControlBuilder WithHeaderColors(Color foreground, Color background)
Parameters
foregroundColorbackgroundColor
Returns
WithHeight(int)
Sets the explicit height.
public TableControlBuilder WithHeight(int height)
Parameters
heightint
Returns
WithHorizontalAlignment(HorizontalAlignment)
Sets the horizontal alignment.
public TableControlBuilder WithHorizontalAlignment(HorizontalAlignment alignment)
Parameters
alignmentHorizontalAlignment
Returns
WithMargin(int)
Sets the margin around the table.
public TableControlBuilder WithMargin(int margin)
Parameters
marginint
Returns
WithMargin(int, int)
Sets the margin with separate horizontal and vertical values.
public TableControlBuilder WithMargin(int horizontal, int vertical)
Parameters
Returns
WithMargin(int, int, int, int)
Sets the margin with individual values.
public TableControlBuilder WithMargin(int left, int top, int right, int bottom)
Parameters
Returns
WithName(string)
Sets the control name for lookup.
public TableControlBuilder WithName(string name)
Parameters
namestring
Returns
WithRows(IEnumerable<TableRow>)
Adds multiple rows to the table.
public TableControlBuilder WithRows(IEnumerable<TableRow> rows)
Parameters
rowsIEnumerable<TableRow>
Returns
WithSafeBorder(bool)
Enables safe border characters for compatibility.
public TableControlBuilder WithSafeBorder(bool useSafe = true)
Parameters
useSafebool
Returns
WithStickyPosition(StickyPosition)
Sets the sticky position.
public TableControlBuilder WithStickyPosition(StickyPosition position)
Parameters
positionStickyPosition
Returns
WithTag(object)
Sets the tag for custom data.
public TableControlBuilder WithTag(object tag)
Parameters
tagobject
Returns
WithTitle(string, Justify)
Sets the table title.
public TableControlBuilder WithTitle(string title, Justify alignment = Justify.Center)
Parameters
titlestringalignmentJustify
Returns
WithVerticalAlignment(VerticalAlignment)
Sets the vertical alignment.
public TableControlBuilder WithVerticalAlignment(VerticalAlignment alignment)
Parameters
alignmentVerticalAlignment
Returns
WithVisibility(bool)
Sets the visibility.
public TableControlBuilder WithVisibility(bool visible)
Parameters
visiblebool
Returns
WithWidth(int)
Sets the explicit width.
public TableControlBuilder WithWidth(int width)
Parameters
widthint
Returns
Operators
implicit operator TableControl(TableControlBuilder)
Implicit conversion to TableControl.
public static implicit operator TableControl(TableControlBuilder builder)
Parameters
builderTableControlBuilder