Formatting Approaches

  • 2 min to read

DevExpress data-aware controls provide a complete set of options to format display values.

Standard or Custom Format Specifiers

Allows you format numeric and date-time values according to predefined or custom patterns. For instance, a numeric value can be represented as a currency amount or a hexadecimal value, using scientific notation, etc. A date-time value can be represented in the standard Short Date. Long Date or Full Date-Time form.

Standard Specifiers Sample

Example: How to: Format Display Values via Standard Format Specifiers

Composite Formatting

Extends the previous one, as it allows you to format numeric and date-time values using one of the standard or custom format specifiers, and allows you to add any custom text to the resultant string.

Composite Formatting Sample

Example: How to: Format Display Values via Composite Formatting

Event-Based Formatting

DevExpress data-aware controls provide events that allow you to manually specify the display text. For instance, the DXGrid provides the GridControl.CustomColumnDisplayText event allowing you to provide custom text for any data cell. Editor controls shipped within the DXEditors Library provide the BaseEdit.CustomDisplayText event, which enables you to display a custom string within the editor.

Using Mask Settings

Our WPF Data Editors provide the masked input features. When using masks, turn on TextEdit.MaskUseAsDisplayFormat and use mask settings to format display values.