Class DataGridTextColumn
- Namespace
- Myra.Graphics2D.UI.Data
- Assembly
- Myra.dll
A DataGrid column that displays text values, inheriting configuration from DataGridColumnBase.
public class DataGridTextColumn : DataGridColumnBase
- Inheritance
-
DataGridTextColumn
- Inherited Members
Constructors
DataGridTextColumn()
Initializes a new instance of the DataGridTextColumn class with default values.
public DataGridTextColumn()
DataGridTextColumn(string, int, string)
Initializes a new instance of the DataGridTextColumn class with the specified property and width, using the property name as the header text.
public DataGridTextColumn(string property, int width = 100, string format = null)
Parameters
propertystringThe name of the property on the data object to bind to.
widthintThe width of the column in pixels.
formatstringAn optional format string applied to the value (e.g.
"{0:C2}").
DataGridTextColumn(string, string, int, string)
Initializes a new instance of the DataGridTextColumn class with the specified property, header, and width.
public DataGridTextColumn(string property, string header, int width = 100, string format = null)
Parameters
propertystringThe name of the property on the data object to bind to.
headerstringThe text displayed in the column header.
widthintThe width of the column in pixels.
formatstringAn optional format string applied to the value (e.g.
"{0:C2}").
Properties
Flags
Gets the DataGridColumnFlags describing which capabilities this column type supports.
public override DataGridColumnFlags Flags { get; }
Property Value
Format
Gets or sets the format string applied to the cell value before display (e.g. "{0:C2}").
When null or empty, the value's ToString result is used directly.
public string Format { get; set; }
Property Value
Methods
CreateWidget(object, DataGridStyle)
Creates the widget used to display the cell value. The DataGridStyle is provided so the column can apply the appropriate cell style.
public override Widget CreateWidget(object value, DataGridStyle style)
Parameters
valueobjectThe bound property value of the cell.
styleDataGridStyleThe active DataGrid style.
Returns
- Widget
The widget to display, or
nullfor an empty cell.