Table of Contents

Class TableControlBuilder

Namespace
SharpConsoleUI.Builders
Assembly
SharpConsoleUI.dll

Fluent builder for creating TableControl instances with comprehensive configuration.

public sealed class TableControlBuilder : IControlBuilder<TableControl>
Inheritance
TableControlBuilder
Implements
Inherited Members
Extension Methods

Methods

AddColumn(TableColumn)

Adds a custom column to the table.

public TableControlBuilder AddColumn(TableColumn column)

Parameters

column TableColumn

Returns

TableControlBuilder

AddColumn(string, TextJustification, int?)

Adds a column to the table.

public TableControlBuilder AddColumn(string header, TextJustification alignment = TextJustification.Left, int? width = null)

Parameters

header string
alignment TextJustification
width int?

Returns

TableControlBuilder

AddRow(TableRow)

Adds a custom row to the table.

public TableControlBuilder AddRow(TableRow row)

Parameters

row TableRow

Returns

TableControlBuilder

AddRow(params string[])

Adds a row with the specified cells.

public TableControlBuilder AddRow(params string[] cells)

Parameters

cells string[]

Returns

TableControlBuilder

AlignBottom()

Aligns the table to the bottom vertically.

public TableControlBuilder AlignBottom()

Returns

TableControlBuilder

Build()

Builds the TableControl with all configured options.

public TableControl Build()

Returns

TableControl

CenterHorizontal()

Centers the table horizontally.

public TableControlBuilder CenterHorizontal()

Returns

TableControlBuilder

CenterVertical()

Centers the table vertically.

public TableControlBuilder CenterVertical()

Returns

TableControlBuilder

Centered()

Centers the table horizontally and vertically.

public TableControlBuilder Centered()

Returns

TableControlBuilder

DoubleLine()

Uses double-line border style.

public TableControlBuilder DoubleLine()

Returns

TableControlBuilder

DoubleLineBorder()

Uses double-line border style.

public TableControlBuilder DoubleLineBorder()

Returns

TableControlBuilder

Hidden()

Hides the table.

public TableControlBuilder Hidden()

Returns

TableControlBuilder

HideHeader()

Hides the header row.

public TableControlBuilder HideHeader()

Returns

TableControlBuilder

Interactive()

Enables editing mode (sets ReadOnly to false), allowing inline cell editing and column resizing.

public TableControlBuilder Interactive()

Returns

TableControlBuilder

NoBorder()

Uses no border.

public TableControlBuilder NoBorder()

Returns

TableControlBuilder

OnCellActivated(EventHandler<(int Row, int Column)>)

Wires the CellActivated event handler.

public TableControlBuilder OnCellActivated(EventHandler<(int Row, int Column)> handler)

Parameters

handler EventHandler<(int Line, int Column)>

Returns

TableControlBuilder

OnCellEditCompleted(EventHandler<(int Row, int Column, string OldValue, string NewValue)>)

Wires the CellEditCompleted event handler.

public TableControlBuilder OnCellEditCompleted(EventHandler<(int Row, int Column, string OldValue, string NewValue)> handler)

Parameters

handler EventHandler<(int Row, int Column, string OldValue, string NewValue)>

Returns

TableControlBuilder

OnRightClick(EventHandler<MouseEventArgs>)

Wires the MouseRightClick event handler for context menu support.

public TableControlBuilder OnRightClick(EventHandler<MouseEventArgs> handler)

Parameters

handler EventHandler<MouseEventArgs>

Returns

TableControlBuilder

OnRowActivated(EventHandler<int>)

Wires the RowActivated event handler.

public TableControlBuilder OnRowActivated(EventHandler<int> handler)

Parameters

handler EventHandler<int>

Returns

TableControlBuilder

OnSelectedRowChanged(EventHandler<int>)

Wires the SelectedRowChanged event handler.

public TableControlBuilder OnSelectedRowChanged(EventHandler<int> handler)

Parameters

handler EventHandler<int>

Returns

TableControlBuilder

Rounded()

Uses rounded border style.

public TableControlBuilder Rounded()

Returns

TableControlBuilder

ShowHeader(bool)

Shows or hides the header row.

public TableControlBuilder ShowHeader(bool show = true)

Parameters

show bool

Returns

TableControlBuilder

ShowRowSeparators(bool)

Shows or hides row separators.

public TableControlBuilder ShowRowSeparators(bool show = true)

Parameters

show bool

Returns

TableControlBuilder

SingleLine()

Uses single-line border style.

public TableControlBuilder SingleLine()

Returns

TableControlBuilder

StickyBottom()

Makes the table stick to the bottom during scrolling.

public TableControlBuilder StickyBottom()

Returns

TableControlBuilder

StickyTop()

Makes the table stick to the top during scrolling.

public TableControlBuilder StickyTop()

Returns

TableControlBuilder

StretchHorizontal()

Stretches the table horizontally to fill available width.

public TableControlBuilder StretchHorizontal()

Returns

TableControlBuilder

WithBackgroundColor(Color?)

Sets the background color.

public TableControlBuilder WithBackgroundColor(Color? color)

Parameters

color Color?

Returns

TableControlBuilder

WithBorderColor(Color)

Sets the border color.

public TableControlBuilder WithBorderColor(Color color)

Parameters

color Color

Returns

TableControlBuilder

WithBorderStyle(BorderStyle)

Sets the border style.

public TableControlBuilder WithBorderStyle(BorderStyle style)

Parameters

style BorderStyle

Returns

TableControlBuilder

WithCellNavigation()

Enables cell-level navigation with Tab/Left/Right keys.

public TableControlBuilder WithCellNavigation()

Returns

TableControlBuilder

WithCheckboxMode()

Enables checkbox mode for multi-selection.

public TableControlBuilder WithCheckboxMode()

Returns

TableControlBuilder

WithColors(Color?, Color?)

Sets both foreground and background colors. Pass null to inherit from container.

public TableControlBuilder WithColors(Color? foreground, Color? background)

Parameters

foreground Color?
background Color?

Returns

TableControlBuilder

WithColumnResize()

Enables column resizing by dragging column borders. Implies Interactive().

public TableControlBuilder WithColumnResize()

Returns

TableControlBuilder

WithColumns(params string[])

Adds multiple columns from header names.

public TableControlBuilder WithColumns(params string[] headers)

Parameters

headers string[]

Returns

TableControlBuilder

WithDataSource(ITableDataSource)

Sets the virtual data source for lazy loading.

public TableControlBuilder WithDataSource(ITableDataSource dataSource)

Parameters

dataSource ITableDataSource

Returns

TableControlBuilder

WithFiltering()

Enables inline filtering with '/' key. Implies Interactive().

public TableControlBuilder WithFiltering()

Returns

TableControlBuilder

WithForegroundColor(Color?)

Sets the foreground (text) color. Pass null to inherit from container.

public TableControlBuilder WithForegroundColor(Color? color)

Parameters

color Color?

Returns

TableControlBuilder

WithFuzzyFilter()

Enables fuzzy (character-subsequence) filter matching. Implies WithFiltering().

public TableControlBuilder WithFuzzyFilter()

Returns

TableControlBuilder

WithHeaderColors(Color, Color)

Sets the header colors.

public TableControlBuilder WithHeaderColors(Color foreground, Color background)

Parameters

foreground Color
background Color

Returns

TableControlBuilder

WithHeight(int)

Sets the explicit height.

public TableControlBuilder WithHeight(int height)

Parameters

height int

Returns

TableControlBuilder

WithHorizontalAlignment(HorizontalAlignment)

Sets the horizontal alignment.

public TableControlBuilder WithHorizontalAlignment(HorizontalAlignment alignment)

Parameters

alignment HorizontalAlignment

Returns

TableControlBuilder

WithHorizontalScrollbar(ScrollbarVisibility)

Sets the horizontal scrollbar visibility.

public TableControlBuilder WithHorizontalScrollbar(ScrollbarVisibility visibility)

Parameters

visibility ScrollbarVisibility

Returns

TableControlBuilder

WithInlineEditing()

Enables inline cell editing with F2 to start, Enter to commit, Escape to cancel. Implies Interactive().

public TableControlBuilder WithInlineEditing()

Returns

TableControlBuilder

WithMargin(int)

Sets the margin around the table.

public TableControlBuilder WithMargin(int margin)

Parameters

margin int

Returns

TableControlBuilder

WithMargin(int, int)

Sets the margin with separate horizontal and vertical values.

public TableControlBuilder WithMargin(int horizontal, int vertical)

Parameters

horizontal int
vertical int

Returns

TableControlBuilder

WithMargin(int, int, int, int)

Sets the margin with individual values.

public TableControlBuilder WithMargin(int left, int top, int right, int bottom)

Parameters

left int
top int
right int
bottom int

Returns

TableControlBuilder

WithMultiSelect()

Enables multi-selection with Ctrl+Click and Shift+Click.

public TableControlBuilder WithMultiSelect()

Returns

TableControlBuilder

WithName(string)

Sets the control name for lookup.

public TableControlBuilder WithName(string name)

Parameters

name string

Returns

TableControlBuilder

WithRows(IEnumerable<TableRow>)

Adds multiple rows to the table.

public TableControlBuilder WithRows(IEnumerable<TableRow> rows)

Parameters

rows IEnumerable<TableRow>

Returns

TableControlBuilder

WithSafeBorder(bool)

Enables safe border characters for compatibility.

public TableControlBuilder WithSafeBorder(bool useSafe = true)

Parameters

useSafe bool

Returns

TableControlBuilder

WithSorting()

Enables column sorting by clicking headers.

public TableControlBuilder WithSorting()

Returns

TableControlBuilder

WithStickyPosition(StickyPosition)

Sets the sticky position.

public TableControlBuilder WithStickyPosition(StickyPosition position)

Parameters

position StickyPosition

Returns

TableControlBuilder

WithTag(object)

Sets the tag for custom data.

public TableControlBuilder WithTag(object tag)

Parameters

tag object

Returns

TableControlBuilder

WithTitle(string, TextJustification)

Sets the table title.

public TableControlBuilder WithTitle(string title, TextJustification alignment = TextJustification.Center)

Parameters

title string
alignment TextJustification

Returns

TableControlBuilder

WithVerticalAlignment(VerticalAlignment)

Sets the vertical alignment.

public TableControlBuilder WithVerticalAlignment(VerticalAlignment alignment)

Parameters

alignment VerticalAlignment

Returns

TableControlBuilder

WithVerticalScrollbar(ScrollbarVisibility)

Sets the vertical scrollbar visibility.

public TableControlBuilder WithVerticalScrollbar(ScrollbarVisibility visibility)

Parameters

visibility ScrollbarVisibility

Returns

TableControlBuilder

WithVisibility(bool)

Sets the visibility.

public TableControlBuilder WithVisibility(bool visible)

Parameters

visible bool

Returns

TableControlBuilder

WithWidth(int)

Sets the explicit width.

public TableControlBuilder WithWidth(int width)

Parameters

width int

Returns

TableControlBuilder

Operators

implicit operator TableControl(TableControlBuilder)

Implicit conversion to TableControl.

public static implicit operator TableControl(TableControlBuilder builder)

Parameters

builder TableControlBuilder

Returns

TableControl