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

PivotCustomFieldDataEventArgs Class

Provides data for the PivotGridControl.CustomUnboundFieldData event.

Namespace: DevExpress.Xpf.PivotGrid

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

Declaration

public class PivotCustomFieldDataEventArgs :
    EventArgs

Remarks

The PivotGridControl.CustomUnboundFieldData event allows you to provide data for unbound fields. The unbound field whose cell is currently processed is specified by the PivotCustomFieldDataEventArgs.Field property. Use the PivotCustomFieldDataEventArgs.Value property, to specify the cell’s value.

Example

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.

<Window xmlns:dxpg="http://schemas.devexpress.com/winfx/2008/xaml/pivotgrid" 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        Title="MainWindow" Height="395" Width="585" 
        x:Class="HowToBindToMDB.MainWindow"
        Loaded="Window_Loaded">
    <Grid>
        <dxpg:PivotGridControl CustomUnboundFieldData="pivotGridControl1_CustomUnboundFieldData"
                               HorizontalAlignment="Left" Name="pivotGridControl1"
                               VerticalAlignment="Top">
            <dxpg:PivotGridControl.Fields>
                <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"
                                     CellFormat="p"/>
                <dxpg:PivotGridField Name="fieldTotalSum" UnboundType="Decimal" Area="DataArea"
                                     Caption="Total Sum"/>
            </dxpg:PivotGridControl.Fields>
        </dxpg:PivotGridControl>
    </Grid>
</Window>

Inheritance

Object
EventArgs
PivotCustomFieldDataEventArgs
See Also