Skip to main content

FormatInfo.FormatType Property

Gets or sets the type of formatting specified by the current FormatInfo object.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v22.2.dll

NuGet Package: DevExpress.Data


public virtual FormatType FormatType { get; set; }

Property Value

Type Description

One of FormatType values specifying the formatting type.

Available values:

Name Description

No formatting is performed.

Setting the FormatInfo.FormatType property to None clears the FormatInfo.FormatString property and sets the FormatInfo.Format object to null.


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.


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).


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.


Use the FormatType and FormatInfo.FormatString properties to format values based on the current language and regional settings (culture). FormatType specifies the type of values to be formatted. FormatInfo.FormatString specifies a format pattern appropriate for the current FormatType value. You can refer to the Standard Numeric Format Strings and Date and Time Format Strings topics in MSDN for information on format specifiers.


Changing the FormatType property automatically resets the FormatString property. Thus, it is recommended to set FormatType prior to FormatString.

Setting the FormatType property changes the format provider used when formatting values by the FormatInfo.GetDisplayText function.

Format providers supply information such as the character to use as the decimal point when formatting numeric strings and the separation character to use when formatting a DateTime object. The FormatInfo.Format property specifies the format provider to use.

You can change the FormatInfo.Format property explicitly by assigning a IFormatProvider object. This can be useful if you wish to format values according to a specific culture (not the current one). In this case, you also need to set the FormatType property to FormatType.Custom.

See Formatting Values, to learn more.


The sample code below formats display values of the date and text editors. The FormatInfo.FormatType and FormatInfo.FormatString properties of the editor’s RepositoryItem.DisplayFormat object are used for this purpose.

The image below displays the editors before and after formatting their display values.

Formatting - Standard

dateEdit1.Properties.DisplayFormat.FormatType = FormatType.DateTime;
dateEdit1.Properties.DisplayFormat.FormatString = "MMMM/yyyy";
textEdit1.Properties.DisplayFormat.FormatType = FormatType.Numeric;
textEdit1.Properties.DisplayFormat.FormatString = "c2";

The following code snippets (auto-collected from DevExpress Examples) contain references to the FormatType property.


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.

See Also