Skip to main content
A newer version of this page is available. .

PivotGridControl.CustomUnboundFieldData Event

Enables providing data to unbound fields.

Namespace: DevExpress.Xpf.PivotGrid

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


public event PivotCustomFieldDataEventHandler CustomUnboundFieldData

Event Data

The CustomUnboundFieldData event's data class is PivotCustomFieldDataEventArgs. The following properties provide information specific to this event:

Property Description
Field Gets the unbound field currently being processed.
ListSourceRowIndex Gets the current row’s index in the data source.
ThreadSafeField Gets the unbound field currently being processed. Provides read-only access to field settings.
Value Gets or sets the value of the cell currently being processed.

The event data class exposes the following methods:

Method Description
GetListSourceColumnValue(Int32, String) Gets the value of the specified field in the specified row in the control’s underlying data source.
GetListSourceColumnValue(String) Gets the value of the specified cell within the current row in the control’s underlying data source.


Unbound fields are not bound to any field in the data source. In most instances, data for unbound fields is obtained from a custom data source or is calculated based upon the values of bound fields. To provide data for unbound fields, you can specify an expression (formula) used to evaluate values for this field using the PivotGridField.UnboundExpression property or handle the CustomUnboundFieldData event.


The CustomUnboundFieldData event is not supported in server and OLAP mode.

To learn more about unbound data, see Unbound Fields.


This example demonstrates how to add an unbound field to the PivotGridControl, to show the total sum of an order.

The PivotGridControl is bound to the Order Details data table (from the nwind sample database), which contains UnitPrice, Quantity and Discount fields. The total sum is calculated as follows: UnitPriceQuantity(1-Discount).

To solve this task, create a PivotGrid’s field and set its PivotGridField.UnboundType property to FieldUnboundColumnType.Decimal. Then, handle the PivotGridControl.CustomUnboundFieldData event and populate the field with data.

View Example

<Window xmlns:dxpg="" 
        Title="MainWindow" Height="600" Width="800" 
        <dxpg:PivotGridControl CustomUnboundFieldData="pivotGridControl1_CustomUnboundFieldData" 
                <dxpg:PivotGridField Name="fieldOrderID" FieldName="OrderID" Area="RowArea"/>
                <dxpg:PivotGridField Name="fieldProductName" FieldName="ProductName" Area="RowArea"/>
                <dxpg:PivotGridField Name="fieldUnitPrice" FieldName="UnitPrice" Area="DataArea"/>
                <dxpg:PivotGridField Name="fieldQuantity" FieldName="Quantity" Area="DataArea"/>
                <dxpg:PivotGridField Name="fieldDiscount" FieldName="Discount" Area="DataArea" 
                <dxpg:PivotGridField Name="fieldTotalSum" UnboundType="Decimal" Area="DataArea"
                                     Caption="Total Sum"/>
See Also