Log In
[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Collapse]Pivot Grid
   [Expand]Getting Started
   [Expand]Binding to Data
   [Collapse]Data Shaping
     Data Formatting
   [Expand]Data Analysis
   [Expand]Focus and Navigation
   [Expand]Printing and Exporting
   [Expand]Design-time Features
   [Expand]UI Elements
   [Expand]End-User Capabilities
   [Expand]Member Tables
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Data Formatting

PivotGridControl allows you to format the display text of its data cells, field values, summaries, totals and grand totals before they are displayed on screen. You can apply standard format strings or implement a custom formatter.

Expanded Formatting Values

There are several common approaches used to format data displayed in DevExpress WinForms data-aware controls (including PivotGridControl). For more information, refer to the following topic from the WinForms Common Concepts section.

Expanded Example: How to Format Cell Values

The following example shows how to format data that corresponds to the 'Quantity' and 'Extended Price' data fields in a sample PivotGridControl.

For the 'Quantity' field, the PivotGridFieldBase.CellFormat property is used to format data in a custom manner. The values that correspond to this field are enclosed with round brackets. The format settings specified by the PivotGridFieldBase.CellFormat property also affect the representation of total and grand total cells

The 'Extended Price' field is bound to a field that contains currency data. By default, the cell values that correspond to such fields are formatted as currency amounts (the formatting settings are determined by the regional settings). For the English (United States) culture, the currency values are represented using two digits to the right of the decimal point. In the example, the PivotGridFieldBase.GrandTotalCellFormat property is used to format grand total cell values for the 'Extended Price' field in a different manner. The data in these cells is formatted as integer currency values (without fractional portions).

The result of the code is shown below:

Expanded See Also

How would you rate this topic?​​​​​​​