Skip to main content

PivotGridField.SortOrder Property

Gets or sets the field sort order. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

Assembly: DevExpress.Xpf.PivotGrid.v22.1.dll

NuGet Package: DevExpress.Wpf.PivotGrid


public FieldSortOrder SortOrder { get; set; }

Property Value

Type Description

A FieldSortOrder enumeration member that specifies the field sort order.

Available values:

Name Description

Sorts the field in ascending order.


Sorts the field in descending order.


Data within the PivotGridControl is always sorted against fields displayed within Column Header Area and Row Header Area (by default, in ascending order). Use the SortOrder property of these fields to change the current sort order. For other fields, changing the SortOrder property value has no effect on data representation, until these fields are placed within the Column Header Area or Row Header Area.

You can also use the PivotGridField.ChangeSortOrder (synchronous) and PivotGridControl.ChangeFieldSortOrderAsync (asynchronous) methods to toggle a field sort order.


The SortOrder property is not in effect for the excel-style pop-up filter.

When the field sort order is changed, the PivotGridControl.GridLayout event occurs.

To implement custom sorting, handle the PivotGridControl.CustomFieldSort event.


This example shows how to sort data by Grand Total values.

In this example, values of the Sales Person field are sorted by the Grand Total column. To do this, the data field by whose values the sorting should be performed (the Order Amount field) is assigned to the Sales Person field’s PivotGridField.SortByField property.

View Example

<Window x:Class="HowToBindToMDB.MainWindow"
        Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
        <dxpg:PivotGridControl HorizontalAlignment="Left" Name="pivotGridControl1" 
                <dxpg:PivotGridField Name="fieldMonth" FieldName="OrderDate" Area="RowArea"
                                     Caption="Order Month" GroupInterval="DateMonth" />
                <dxpg:PivotGridField Name="fieldSalesPerson" FieldName="Sales Person" Area="RowArea"
                                     SortByField="{Binding ElementName=fieldOrderAmount}"
                                     Caption="Sales Person" SortOrder="Descending"/>                
                <dxpg:PivotGridField Name="fieldOrderAmount" FieldName="Extended Price" Area="DataArea"
                                     Caption="Order Amount" CellFormat="c0" />
See Also