Class TableView.ColumnStyle
Describes how to render a given column in a TableView including Alignment
and textual representation of cells (e.g. date formats)
See TableView Deep Dive for more information.
Inheritance
System.Object
TableView.ColumnStyle
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class ColumnStyle : Object
Constructors
ColumnStyle()
Declaration
public ColumnStyle()
Fields
AlignmentGetter
Defines a delegate for returning custom alignment per cell based on cell values. When specified this will override Alignment
Declaration
public Func<object, TextAlignment> AlignmentGetter
Field Value
Type | Description |
---|---|
System.Func<System.Object, TextAlignment> |
ColorGetter
Defines a delegate for returning a custom color scheme per cell based on cell values.
Return null for the default
Declaration
public TableView.CellColorGetterDelegate ColorGetter
Field Value
Type | Description |
---|---|
TableView.CellColorGetterDelegate |
RepresentationGetter
Defines a delegate for returning custom representations of cell values. If not set then System.Object.ToString is used. Return values from your delegate may be truncated e.g. based on MaxWidth
Declaration
public Func<object, string> RepresentationGetter
Field Value
Type | Description |
---|---|
System.Func<System.Object, System.String> |
Properties
Alignment
Defines the default alignment for all values rendered in this column. For custom alignment based on cell contents use AlignmentGetter.
Declaration
public TextAlignment Alignment { get; set; }
Property Value
Type | Description |
---|---|
TextAlignment |
Format
Defines the format for values e.g. "yyyy-MM-dd" for dates
Declaration
public string Format { get; set; }
Property Value
Type | Description |
---|---|
System.String |
MaxWidth
Set the maximum width of the column in characters. This value will be ignored if more than the tables MaxCellWidth. Defaults to DefaultMaxCellWidth
Declaration
public int MaxWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MinAcceptableWidth
Enables flexible sizing of this column based on available screen space to render into.
Declaration
public int MinAcceptableWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MinWidth
Set the minimum width of the column in characters. Setting this will ensure that
even when a column has short content/header it still fills a given width of the control.
For setting a flexible column width (down to a lower limit) use MinAcceptableWidth
instead
This value will be ignored if more than the tables MaxCellWidth or the MaxWidth
Declaration
public int MinWidth { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
GetAlignment(Object)
Declaration
public TextAlignment GetAlignment(object cellValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | cellValue |
Returns
Type | Description |
---|---|
TextAlignment |
GetRepresentation(Object)
Returns the full string to render (which may be truncated if too long) that the current style says best represents the given
value
Declaration
public string GetRepresentation(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type | Description |
---|---|
System.String |