Back to Devexpress

PivotGridField.CellFormat Property

wpf-devexpress-dot-xpf-dot-pivotgrid-dot-pivotgridfield-acc18f74.md

latest6.0 KB
Original Source

PivotGridField.CellFormat Property

Gets or sets the string used to format the cells. This is a dependency property.

Namespace : DevExpress.Xpf.PivotGrid

Assembly : DevExpress.Xpf.PivotGrid.v25.2.dll

NuGet Package : DevExpress.Wpf.PivotGrid

Declaration

csharp
public string CellFormat { get; set; }
vb
Public Property CellFormat As String

Property Value

TypeDescription
String

A string used to format the cells.

|

Remarks

This property allows you to format values using the format strings described in the Standard Numeric Format Strings, Custom Numeric Format Strings, Standard Date and Time Format Strings and Custom Date and Time Format Strings topics in MSDN.

To learn more, see Standard Formatting.

Example

The following example shows how to format Order Date field values and summaries corresponding to the Extended Price field. Order Date field values are formatted using a long date pattern while Extended Price summaries are formatted as integer currency values.

The result of the code is shown below:

xaml
<dxpg:PivotGridControl.Fields>
    <dxpg:PivotGridField Area="DataArea" FieldName="Extended_Price" CellFormat="c0"/>
    <dxpg:PivotGridField Area="RowArea" FieldName="OrderDate" GroupInterval="Date" ValueFormat="D"/>
    <dxpg:PivotGridField Area="ColumnArea" FieldName="Country"/>  
</dxpg:PivotGridControl.Fields>

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

Note

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.

wpf-pivotgrid-hide-column-totals/CS/HowToBindToMDB/MainWindow.xaml#L23

xml
</dxpg:PivotGridField>
<dxpg:PivotGridField Name="fieldUnitPrice" Area="DataArea" CellFormat="c2">
    <dxpg:PivotGridField.DataBinding>

wpf-pivot-grid-create-field-value-template/CS/HowToCreateFieldValueTemplate/MainWindow.xaml#L42

xml
</dxpg:PivotGridField>
<dxpg:PivotGridField Name="fieldExtendedPrice" Area="DataArea" CellFormat="c0" >
    <dxpg:PivotGridField.DataBinding>

wpf-pivot-grid-define-custom-cell-template-to-performing-data-editing/CS/HowToEditCell/MainWindow.xaml#L84

xml
Caption="Percent Of Column"
CellFormat="p"
Name="fieldExtendedPrice2">

wpf-pivot-custom-group-intervals/CS/HowToCustomGroupInterval/MainWindow.xaml#L25

xml
<dxpg:PivotGridField Name="fieldExtendedPrice"
                     Area="DataArea" CellFormat="c0">
    <dxpg:PivotGridField.DataBinding>

wpf-pivot-grid-obtain-underlying-data/CS/ObtainUnderlyingData/MainWindow.xaml#L102

xml
Area="DataArea"
CellFormat="c0"
Name="fieldExtendedPrice" >

wpf-pivot-grid-bind-to-an-olap-cube-net6/CS/HowToBindOLAP/MainWindow.xaml.cs#L29

csharp
fieldSales.Area = FieldArea.DataArea;
fieldSales.CellFormat = "c";
pivotGridControl1.Fields.Add(fieldSales);

wpf-pivot-grid-bind-to-an-olap-cube-net6/VB/HowToBindOLAP/MainWindow.xaml.vb#L27

vb
fieldSales.Area = FieldArea.DataArea
fieldSales.CellFormat = "c"
pivotGridControl1.Fields.Add(fieldSales)

See Also

TotalCellFormat

GrandTotalCellFormat

PivotGridField Class

PivotGridField Members

DevExpress.Xpf.PivotGrid Namespace