PivotCustomSummaryEventArgs.CreateDrillDownDataSource() Method

Returns a list of the records which are associated with the cell currently being processed.

Namespace: DevExpress.Xpf.PivotGrid

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


public PivotDrillDownDataSource CreateDrillDownDataSource()
Public Function CreateDrillDownDataSource As PivotDrillDownDataSource


Type Description

A PivotDrillDownDataSource object which contains the records which are associated with the current cell.


The CreateDrillDownDataSource method allows you to retrieve the subset of records from the control's underlying data source that are associated with the current cell.

The cells in the PivotGrid control display summary and total summary values. Each summary and total summary value is calculated for a specific subset of records in the control's underlying data source. These records are identified by the values of the column and row fields which are displayed within the column and row headers. The CreateDrillDownDataSource method returns a PivotDrillDownDataSource object, which represents a list of these records.


This example demonstrates how to count distinct values (the number of orders with equal product quantities) and display the result in the pivot grid.

This example handles the CustomSummary event that occurs when the control calculates a summary for a field whose SummaryType is PivotSummaryType.Custom. The event handler calls the e.CreateDrillDownDataSource method to retrieve the underlying data rows for the current cell, counts distinct values and returns the result to the e.CustomValue property.


The complete sample project How to Create a Custom Summary Type to Display the Distinct Value Count is available in the DevExpress Examples repository.

<dx:ThemedWindow x:Class="DXPivotGrid_CustomSummary.MainWindow" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800" 

        <dxpg:PivotGridControl CustomSummary="pivotGridControl1_CustomSummary" Loaded="PivotGridControl1_Loaded" Name="pivotGridControl1">
                <dxpg:PivotGridField Name="fieldCategoryName" FieldName="CategoryName" Area="RowArea" AreaIndex="0" Caption="Category Name" />
                <dxpg:PivotGridField Name="fieldProductName" FieldName="ProductName" Area="RowArea" AreaIndex="1" Caption="Product Name" />
                <dxpg:PivotGridField Name="fieldOrderDate" FieldName="OrderDate" Area="ColumnArea" AreaIndex="0" Caption="OrderDate" GroupInterval="DateYear" />
                <dxpg:PivotGridField Name="fieldQuantity" FieldName="Quantity" Area="DataArea" AreaIndex="0" Caption="Quantity" />
                <dxpg:PivotGridField Name="fieldQuantityDistinctCount" FieldName="Quantity" Area="DataArea" AreaIndex="1" Caption="Count Distinct" SummaryType="Custom" />

See Also