[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
   Reporting
  [Collapse]Data Grid
   [Expand]Getting Started
   [Expand]Implementation Details
   [Expand]Views
   [Expand]Grid View Data Layout
   [Expand]Binding to Data
   [Expand]Master-Detail Data Representation
   [Expand]Data Editing and Validation
   [Expand]Grouping
   [Expand]Filtering and Searching
   [Expand]Sorting
   [Expand]Data Summaries
   [Expand]Paging and Scrolling
   [Expand]Focus, Navigation, Selection
   [Expand]Drag-and-Drop
   [Expand]Conditional Formatting
   [Collapse]Appearance Customization
     Styles and Templates Overview
     Grid Control Styles
     Grid Elements That Support Templates
     Choosing Templates Based on Custom Logic
     Format Cell Values
     Cell Merging
    [Expand]Column Header Customization
   [Expand]MVVM Enhancements
   [Expand]Printing and Exporting
   [Expand]End-User Interaction
   [Expand]Miscellaneous
   [Expand]Performance Improvement
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]End-User Capabilities
   [Expand]Examples
  [Expand]Ribbon, Bars and Menu
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Printing-Exporting
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Format Cell Values

This topic describes approaches to formatting cell values.

Approach

Affects the Column Type

Affects Sorting / Filtering / Grouping

Supports Printing / Exporting

Works in Edit Mode

GridControl / GridColumn

CustomColumnDisplayText

*

(WYSIWYG mode only)

Unbound Columns

*

Columns with Binding

*

EditSettings

DisplayFormat

*

DisplayTextConverter

*

Masked Input

*

Cell Templates

DisplayFormatString

DisplayTextConverter

Masked Input

* Except Server Mode and Virtual Sources

Expanded GridControl / GridColumn

The GridControl / GridColumn support the following ways to format cell values:

CustomColumnDisplayText

The GridControl.CustomColumnDisplayText and TreeListView.CustomColumnDisplayText events allow you to customize text within any cell.

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting: (WYSIWYG mode only)
  • Works in edit mode:

Unbound Columns

The GridControl allows you to display Unbound Columns:

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting:
  • Works in edit mode:

Columns with Binding

You can use the ColumnBase.Binding property to associate a grid column with a data source's property. Refer to Columns with Binding for more information.

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting:
  • Works in edit mode:

Expanded EditSettings

You can use in-place Data Editors to edit cell values. Each editor has a helper class (the BaseEditSettings (see BaseEditSettings) descendant) responsible for the editor's functionality. You can use the column's ColumnBase.EditSettings property to specify an in-place editor's settings.

DisplayFormat

The BaseEditSettings.DisplayFormat property specifies the pattern used to format the editor's display value.

For example, set the DisplayFormat property to c2 to display currency values. If the editor's value is 99.9, its formatted equivalent is $99.90.

Refer to the Format Specifiers topic for more information on the available DisplayFormat values.

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting:
  • Works in edit mode:

DisplayTextConverter

The BaseEditSettings.DisplayTextConverter property specifies a converter that provides the editor's display value.

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting:
  • Works in edit mode:

Masked Input

You can define an editor's mask settings using the properties with the Mask prefix (for example, the TextEditSettings.MaskType, TextEditSettings.Mask, TextEditSettings.MaskCulture, etc.).

Masks are used in edit mode. Set the TextEditSettings.MaskUseAsDisplayFormat property to true to use the specified mask in display mode. If this property is false, the BaseEditSettings.DisplayFormat format specifies an editor's display text.

Refer to Masked Input for more information.

  • Affects the column type:
  • Affects sorting/filtering/grouping: (except Server Mode and Virtual Sources)
  • Supports printing/exporting:
  • Works in edit mode:

Expanded Cell Templates

The ColumnBase.CellTemplate / DataViewBase.CellTemplate properties specify Cell Templates that define the column cells' appearance.

Tip

You can use separate templates to present and edit data:

Note

Cell templates do not support Printing and Exporting. To print and export data with formatted cell values:

DisplayFormatString

The BaseEdit.DisplayFormatString property specifies the pattern used to format the editor's display value.

For example, set the DisplayFormatString property to c2 to display currency values. If the editor's value is 99.9, its formatted equivalent is $99.90.

Refer to the Format Specifiers topic for more information on available DisplayFormatString values.

  • Affects the column type:
  • Affects sorting/filtering/grouping:
  • Supports printing/exporting:
  • Works in edit mode:

DisplayTextConverter

The BaseEdit.DisplayTextConverter property specifies a converter that provides the editor's display value.

  • Affects the column type:
  • Affects sorting/filtering/grouping:
  • Supports printing/exporting:
  • Works in edit mode:

Masked Input

You can define an editor's mask settings using the properties with the Mask prefix (such as the TextEdit.MaskType, TextEdit.Mask, TextEdit.MaskCulture, etc.).

Masks are used in edit mode. Set the TextEdit.MaskUseAsDisplayFormat property to true to use the specified mask in display mode. If this property is false, the BaseEdit.DisplayFormatString format specifies an editor's display text.

Refer to Masked Input for more information.

  • Affects the column type:
  • Affects sorting/filtering/grouping:
  • Supports printing/exporting:
  • Works in edit mode:

Expanded See Also

Is this topic helpful?​​​​​​​