LookUpColumnInfo.FormatType Property
Gets or sets the type of formatting applied when displaying column values.
Namespace: DevExpress.XtraEditors.Controls
Assembly: DevExpress.XtraEditors.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
[DefaultValue(FormatType.None)]
[DXCategory("Format")]
public FormatType FormatType { get; set; }
Property Value
Type | Default | Description |
---|---|---|
FormatType | None | The FormatType value specifying the format type. |
Available values:
Name | Description |
---|---|
None | No formatting is performed. Setting the FormatInfo.FormatType property to None clears the FormatInfo.FormatString property and sets the FormatInfo.Format object to null. |
Numeric | Specifies that values should be formatted as numbers. Setting FormatInfo.FormatType to Numeric assigns the static System.Globalization.NumberFormatInfo.CurrentInfo format provider to the FormatInfo.Format property. This defines the format provider for the current culture. Also FormatInfo.FormatString is set to an empty string. |
DateTime | Specifies that values should be formatted as the DateTime type. Setting FormatInfo.FormatType to DateTime assigns the static CurrentInfo format provider to the FormatInfo.Format property. This defines the format provider for the current culture. Also FormatInfo.FormatString is set to “d” (short date pattern). |
Custom | Use Custom to format string values. Use Custom when assigning a custom IFormatProvider to the FormatInfo.Format property. Setting FormatInfo.FormatType to Custom does not change the FormatInfo.Format and FormatInfo.FormatString property values. |
Remarks
Use the FormatType and LookUpColumnInfo.FormatString properties to apply formatting to column values.
An editor needs to know the type of data displayed in the column in order to recognize the pattern used to format column values. If column values are numeric, set the FormatType to FormatType.Numeric. If the column displays date/time values, set the property to FormatType.DateTime. The FormatType.None value indicates that no formatting is to be applied.
To specify the format pattern, see the LookUpColumnInfo.FormatString property. The Format Specifiers document provides more information on the format strings available.
Note: after changing the format type, FormatInfo.FormatString is cleared. So you need to set FormatInfo.FormatString after the format type is specified.
If you create columns using the RepositoryItemLookUpEdit.PopulateColumns method, the editor automatically sets the appropriate FormatType value for columns bound to numeric and date/time fields.