The PivotDrillDownDataSource object is returned by the CreateDrillDownDataSource method, provided by the PivotGrid control. The method overloads allow you to obtain a list of the records which are used to calculate summaries for individual cells.
The PivotDrillDownDataSource class implements the IList interface, so the data returned by the CreateDrillDownDataSource method can easily be displayed in a grid control (XtraGrid or DataGrid).
The following example shows how to display the records from the control’s underlying data source which correspond to a particular cell. A new form that displays these records is opened when a particular cell in the PivotGrid control is double-clicked.
usingDevExpress.XtraPivotGrid;
privatevoidpivotGridControl1_CellDoubleClick(object sender, PivotCellEventArgs e) {
// Create a new form.
Form form = new Form();
form.Text = "Records";
// Place a DataGrid control on the form.
DataGrid grid = new DataGrid();
grid.Parent = form;
grid.Dock = DockStyle.Fill;
// Get the recrd set associated with the current cell and bind it to the grid.
grid.DataSource = e.CreateDrillDownDataSource();
form.Bounds = new Rectangle(100, 100, 500, 400);
// Display the form.
form.ShowDialog();
form.Dispose();
}
ImportsDevExpress.XtraPivotGridPrivateSub pivotGridControl1_CellDoubleClick(ByVal sender AsObject, _
ByVal e As PivotCellEventArgs) Handles pivotGridControl1.CellDoubleClick
' Create a new form.Dim form As Form = New Form
form.Text = "Records"' Place a DataGrid control on the form.Dim grid As DataGrid = New DataGrid
grid.Parent = form
grid.Dock = DockStyle.Fill
' Get the recrd set associated with the current cell and bind it to the grid.
grid.DataSource = e.CreateDrillDownDataSource()
form.Bounds = New Rectangle(100, 100, 500, 400)
' Display the form.
form.ShowDialog()
form.Dispose()
EndSub