windowsforms-devexpress-dot-xtragrid-dot-columns-dot-gridcolumn-3dcd79ff.md
Provides access to the object specifying the formatting applied to column values.
Namespace : DevExpress.XtraGrid.Columns
Assembly : DevExpress.XtraGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Grid, DevExpress.Win.Navigation
[DXCategory("Format")]
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
public FormatInfo DisplayFormat { get; }
<DXCategory("Format")>
<XtraSerializableProperty(XtraSerializationVisibility.Content)>
Public ReadOnly Property DisplayFormat As FormatInfo
| Type | Description |
|---|---|
| FormatInfo |
A FormatInfo object that specifies format settings for column values.
|
Settings provided by this property allow you to format column values in display mode and when the grid is exported/printed.
You can implement cell formatting by using the GridColumn.DisplayFormat.Format property. String formatting implemented in this way is not supported when a grid’s edit values (not display text) are exported to XLS format. To specify the cell export mode, use the RepositoryItem.ExportMode and/or XlExportOptionsBase.TextExportMode properties.
Note
Changing the DisplayFormat. FormatType property automatically resets the DisplayFormat. FormatString property. Thus, it is recommended to set DisplayFormat. FormatType prior to DisplayFormat. FormatString.
Please refer to the following topic for additional information: Formatting Cell Values.
The following examples formats column values using standard format specifiers for date-time and numeric values.
The following image shows the result:
colOrderDate.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
colOrderDate.DisplayFormat.FormatString = "D";
colUnitPrice.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
colUnitPrice.DisplayFormat.FormatString = "c2";
colDiscount.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
colDiscount.DisplayFormat.FormatString = "P0";
colOrderDate.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime
colOrderDate.DisplayFormat.FormatString = "D"
colUnitPrice.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
colUnitPrice.DisplayFormat.FormatString = "c2"
colDiscount.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric
colDiscount.DisplayFormat.FormatString = "P0"
See Also