GridColumn.ColumnType Property
Gets the column’s data type.
Namespace: DevExpress.XtraGrid.Columns
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
Property Value
Type | Description |
---|---|
Type | A System.Type value representing column data type. |
Remarks
The code sample below illustrates how to highlight all DateTime columns in a grid.
gridView1.CustomDrawCell += GridView1_CustomDrawCell;
private void GridView1_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e)
{
GridView view = sender as GridView;
if (column.ColumnType == typeof(DateTime))
{
e.Cache.FillRectangle(Color.Salmon, e.Bounds);
e.Appearance.DrawString(e.Cache, e.DisplayText, e.Bounds);
e.Handled = true;
}
}
Note
Columns return valid ColumnType property values only after a Grid is completely initialized. Call the GridControl.ForceInitialize() method to ensure you do not read the ColumnType property too early.
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ColumnType property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.