FormatInfo.FormatString Property

Gets the pattern for formatting values.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v20.1.dll

Declaration

public virtual string FormatString { get; set; }
Public Overridable Property FormatString As String

Property Value

Type Description
String

The string representing the format pattern.

Remarks

Use the FormatString property to specify the format pattern for formatting values.

Standard format specifiers for composing the format pattern are described in the Standard Numeric Format Strings and Date and Time Format Strings topics in MSDN.

In addition to the format string, you need to specify the format provider which contains information how to interpret the format string. This can be done by defining one of the following properties:

  1. FormatInfo.FormatType. Use this property if you wish to format values based on the current language and regional settings (culture).

    NOTE

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

  2. FormatInfo.Format. The property allows you to specify the format provider for a specific culture.

See Formatting Values, to learn more.

Examples

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";
See Also