GridColumn.DisplayFormat Property
Provides access to the object specifying the formatting applied to column values.
Namespace: DevExpress.XtraGrid.Columns
Assembly: DevExpress.XtraGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
#Declaration
[DXCategory("Format")]
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
public FormatInfo DisplayFormat { get; }
#Property Value
Type | Description |
---|---|
Format |
A Format |
#Remarks
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 Display
Please refer to the following topic for additional information: Formatting Cell Values.
#Example
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";