Search Results for

Show / Hide Table of Contents

# 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

##### Inherited Members

System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class 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 |

#### MinWidth

Set the minimum width of the column in characters. 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)

Returns the alignment for the cell based on `cellValue` and AlignmentGetter/Alignment

##### 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 |