Skip to content
ConsoleMonster
Class

TableColumn

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

A table column definition: header, width rules, overflow, priority (which columns hide first when space is short), a presenter for raw values, tone rules and how the column is summarised in subtotals and totals. The same column definitions drive record cards and record views, so a dataset is described once.

Inheritance

  • object
  • TableColumn

Usage

Explore 107 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 50

Accepted by parameters 57

Constructors

TableColumn 2 overloads
public TableColumn(string header) #

Creates a column.

Parameters

header string required
The header (markup).
public TableColumn(RichText header) #

Creates a column with a multicolour header.

Parameters

header ConsoleMonster.Text.RichText required
The header.

Properties

public string Header { get; set; } #

The header (markup).

public string? ShortHeader { get; set; } #

An optional short header used when the full header exceeds its value-driven width.

public int? Gap { get; set; } #

Optional cells before this column in an unboxed table; the first visible column has no gap.

public ColumnPlacement Placement { get; set; } #

Where evidence moves when this column cannot fit.

public int BelowWidth { get; set; } #

Largest content width at which a Below column moves under its row (default 80).

public bool DimRepeats { get; set; } #

Whether consecutive repeated values of this key are muted while remaining copyable.

public string? UnknownText { get; set; } #

Literal text for missing evidence, or null to keep the ordinary null presenter.

public string? Key { get; set; } #

An identifier for the column (a property name), or null to use the header.

public HorizontalAlignment? Alignment { get; set; } #

Alignment; null = automatic (right for numeric columns, left otherwise). The header follows it.

public HorizontalAlignment? HeaderAlignment { get; set; } #

Optional header alignment independent of the cell values.

public bool Wrap { get; set; } #

Whether values may wrap onto several lines when space is short (default true). Setting it maps to TableColumn.Overflow: true is ColumnOverflow.Wrap, false is ColumnOverflow.Never (identifiers keep their width while other columns give way).

public ColumnOverflow Overflow { get; set; } #

What happens to values wider than the column: wrap (default), truncate at the end, truncate in the middle, or never shorten.

public int MaxLines { get; set; } #

The most lines a wrapped value may use: 0 (the default) follows the table's Table.WrapLines (3 unless changed), TableColumn.Unlimited shows every line. The last line ends with an ellipsis when cut.

public int Priority { get; set; } #

The column's importance when the table is too wide: columns with the lowest priority hide first (ties hide from the right). The default is 0. Key columns never hide.

public bool IsKey { get; set; } #

Whether this is a key column: it never hides, and it titles the record cards.

public bool Flexible { get; set; } #

Whether this column takes spare width when the table expands (the main text column). Flexible columns share it evenly.

public int Weight { get; set; } #

This column's share of the spare width when the table expands, relative to other weighted columns (0, the default, takes no weighted share). When no column has a weight, Flexible columns share the spare width, otherwise the free-text columns in proportion to their widths.

public int? MinWidth { get; set; } #

A minimum width, or null.

public int? MaxWidth { get; set; } #

A maximum width, or null.

public int? Width { get; set; } #

A fixed width, or null.

public ICellPresenter? Presenter { get; set; } #

How raw cell values are shown, or null for automatic (by value type). Markup cells are shown as written.

public IList<RoleRule> RoleRules { get; } #

Conditional tone rules for raw values; the first matching rule wins.

public ColumnAggregate Aggregate { get; set; } #

How the column is summarised in group subtotals and the totals row.

public string Id { get; } #

The identifier: TableColumn.Key, or the header without markup.

Fields

public const int Unlimited #

A TableColumn.MaxLines value that shows every line of the column's values, whatever the table's Table.WrapLines.

Value: 2147483647

Extension Methods

public static TableColumn Aggregate(TableColumn tableColumn, ColumnAggregate value) #

Sets TableColumn.Aggregate: How the column is summarised in group subtotals and the totals row.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Widgets.ColumnAggregate required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property     // C# fluent
tableColumn.Aggregate = value;    tableColumn.Aggregate(value);
public static TableColumn Alignment(TableColumn tableColumn, HorizontalAlignment? value) #

Sets TableColumn.Alignment: Alignment; null = automatic (right for numeric columns, left otherwise). The header follows it.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Layout.HorizontalAlignment? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property     // C# fluent
tableColumn.Alignment = value;    tableColumn.Alignment(value);
public static TableColumn BelowWidth(TableColumn tableColumn, int value) #

Sets TableColumn.BelowWidth: Largest content width at which a Below column moves under its row (default 80).

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property      // C# fluent
tableColumn.BelowWidth = value;    tableColumn.BelowWidth(value);
public static TableColumn DimRepeats(TableColumn tableColumn, bool value = true) #

Sets TableColumn.DimRepeats: Whether consecutive repeated values of this key are muted while remaining copyable.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TableColumn The same instance.

Examples

// C# initializer or property      // C# fluent
tableColumn.DimRepeats = value;    tableColumn.DimRepeats(value);
public static TableColumn Flexible(TableColumn tableColumn, bool value = true) #

Sets TableColumn.Flexible: Whether this column takes spare width when the table expands (the main text column). Flexible columns share it evenly.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Flexible = value;    tableColumn.Flexible(value);
public static TableColumn Gap(TableColumn tableColumn, int? value) #

Sets TableColumn.Gap: Optional cells before this column in an unboxed table; the first visible column has no gap.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Gap = value;         tableColumn.Gap(value);
public static TableColumn Header(TableColumn tableColumn, string value) #

Sets TableColumn.Header: The header (markup).

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value string required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Header = value;      tableColumn.Header(value);
public static TableColumn HeaderAlignment(TableColumn tableColumn, HorizontalAlignment? value) #

Sets TableColumn.HeaderAlignment: Optional header alignment independent of the cell values.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Layout.HorizontalAlignment? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property           // C# fluent
tableColumn.HeaderAlignment = value;    tableColumn.HeaderAlignment(value);
Key 2 overloads
public static TableColumn Key(TableColumn tableColumn, string? value) #

Sets TableColumn.Key: An identifier for the column (a property name), or null to use the header.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value string? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Key = value;         tableColumn.Key(value);
public static TableColumn Key(TableColumn tableColumn, bool value = true) #

Sets TableColumn.IsKey: Whether this is a key column: it never hides, and it titles the record cards.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.IsKey = value;       tableColumn.Key(value);
public static TableColumn MaxLines(TableColumn tableColumn, int value) #

Sets TableColumn.MaxLines: The most lines a wrapped value may use: 0 (the default) follows the table's Table.WrapLines (3 unless changed), TableColumn.Unlimited shows every line. The last line ends with an ellipsis when cut.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.MaxLines = value;    tableColumn.MaxLines(value);
public static TableColumn MaxWidth(TableColumn tableColumn, int? value) #

Sets TableColumn.MaxWidth: A maximum width, or null.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.MaxWidth = value;    tableColumn.MaxWidth(value);
public static TableColumn MinWidth(TableColumn tableColumn, int? value) #

Sets TableColumn.MinWidth: A minimum width, or null.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.MinWidth = value;    tableColumn.MinWidth(value);
public static TableColumn Overflow(TableColumn tableColumn, ColumnOverflow value) #

Sets TableColumn.Overflow: What happens to values wider than the column: wrap (default), truncate at the end, truncate in the middle, or never shorten.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Widgets.ColumnOverflow required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Overflow = value;    tableColumn.Overflow(value);
public static TableColumn Placement(TableColumn tableColumn, ColumnPlacement value) #

Sets TableColumn.Placement: Where evidence moves when this column cannot fit.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Widgets.ColumnPlacement required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property     // C# fluent
tableColumn.Placement = value;    tableColumn.Placement(value);
public static TableColumn Presenter(TableColumn tableColumn, ICellPresenter? value) #

Sets TableColumn.Presenter: How raw cell values are shown, or null for automatic (by value type). Markup cells are shown as written.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value ConsoleMonster.Presenters.ICellPresenter? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property     // C# fluent
tableColumn.Presenter = value;    tableColumn.Presenter(value);
public static TableColumn Priority(TableColumn tableColumn, int value) #

Sets TableColumn.Priority: The column's importance when the table is too wide: columns with the lowest priority hide first (ties hide from the right). The default is 0. Key columns never hide.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Priority = value;    tableColumn.Priority(value);
public static TableColumn RoleRule(TableColumn tableColumn, RoleRule item) #

Adds an item to TableColumn.RoleRules: Conditional tone rules for raw values; the first matching rule wins.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
item ConsoleMonster.Presenters.RoleRule required
The item.

Returns

TableColumn The same instance.
public static TableColumn RoleRules(TableColumn tableColumn, IEnumerable<RoleRule> items) #

Adds items to TableColumn.RoleRules: Conditional tone rules for raw values; the first matching rule wins.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
items System.Collections.Generic.IEnumerable<ConsoleMonster.Presenters.RoleRule> required
The items, in order.

Returns

TableColumn The same instance.
public static TableColumn ShortHeader(TableColumn tableColumn, string? value) #

Sets TableColumn.ShortHeader: An optional short header used when the full header exceeds its value-driven width.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value string? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property       // C# fluent
tableColumn.ShortHeader = value;    tableColumn.ShortHeader(value);
public static TableColumn UnknownText(TableColumn tableColumn, string? value) #

Sets TableColumn.UnknownText: Literal text for missing evidence, or null to keep the ordinary null presenter.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value string? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property       // C# fluent
tableColumn.UnknownText = value;    tableColumn.UnknownText(value);
public static TableColumn Weight(TableColumn tableColumn, int value) #

Sets TableColumn.Weight: This column's share of the spare width when the table expands, relative to other weighted columns (0, the default, takes no weighted share). When no column has a weight, Flexible columns share the spare width, otherwise the free-text columns in proportion to their widths.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Weight = value;      tableColumn.Weight(value);
public static TableColumn Width(TableColumn tableColumn, int? value) #

Sets TableColumn.Width: A fixed width, or null.

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value int? required
The value.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Width = value;       tableColumn.Width(value);
public static TableColumn Wrap(TableColumn tableColumn, bool value = true) #

Sets TableColumn.Wrap: Whether values may wrap onto several lines when space is short (default true). Setting it maps to TableColumn.Overflow: true is ColumnOverflow.Wrap, false is ColumnOverflow.Never (identifiers keep their width while other columns give way).

Parameters

tableColumn ConsoleMonster.Widgets.TableColumn required
The instance.
value bool = true optional
The value; true when omitted.

Returns

TableColumn The same instance.

Examples

// C# initializer or property    // C# fluent
tableColumn.Wrap = value;        tableColumn.Wrap(value);