Data Exploration in Windows Forms Pivot Grid

Pivot grid provides support for drill down and drill up to visualize the pivot information in both abstract and detailed views. The row headers and column headers can be expanded or collapsed programmatically to explore the pivot data.

Collapsing headers

By default, the pivot grid control loads the data by expanding all the row headers and column headers. To collapse either all the headers or specific headers, built-in methods are available in pivot grid.

Collapsing all headers

Both the row and column headers can be collapsed simultaneously by using the CollapseAllGroups method.

Refer to the below code sample to collapse all the headers including row headers and column headers.

this.pivotGridControl1.TableControl.CollapseAllGroups();
Me.pivotGridControl1.TableControl.CollapseAllGroups()

Collapsing all row headers

All the row headers can be collapsed by using the CollapseAllRowGroups method.

Refer to the below code sample to collapse all the row headers.

this.pivotGridControl1.TableControl.CollapseAllRowGroups();
Me.pivotGridControl1.TableControl.CollapseAllRowGroups()

Collapsing all column headers

All the column headers can be collapsed by using the CollapseAllColumnGroups method.

Refer to the below code sample to collapse all the row headers.

this.pivotGridControl1.TableControl.CollapseAllColumnGroups();
Me.pivotGridControl1.TableControl.CollapseAllColumnGroups()

Collapsing specific headers

Collapsing specific row header

Specific row header can be collapsed by specifying the name of corresponding pivot row item in the CollapseRow method.

Refer to the below code sample to collapse the pivot row item which specifies ‘Bike’.

this.pivotGridControl1.TableControl.CollapseRow("Bike");
Me.pivotGridControl1.TableControl.CollapseRow("Bike")

Collapsing specific column header

Specific column header can be collapsed by specifying the name of corresponding pivot column item in the CollapseColumn method.

Refer to the below code sample to collapse the pivot column item which specifies ‘Canada’.

this.pivotGridControl1.TableControl.CollapseColumn("Canada");
Me.pivotGridControl1.TableControl.CollapseColumn("Canada")

Collapsing collection of row headers

The collection of row headers can be collapsed by specifying the list of pivot row item’s names in the CollapseRow method.

Refer to the below code sample to collapse the pivot row items of ‘Bike’ and ‘Car’.

var pivotRows = new List<string>();
pivotRows.AddRange(new string[] { "Bike", "Car"});
this.pivotGridControl1.TableControl.CollapseRow(pivotRows);
Dim pivotRows = New List(Of String)()
pivotRows.AddRange(New String() {"Bike", "Car"})
Me.pivotGridControl1.TableControl.CollapseRow(pivotRows)

Collapsing collection of column headers

The collection of column headers can be collapsed by specifying the list of pivot column item’s names in the CollapseColumn method.

Refer to the below code sample to collapse the pivot column items of ‘Canada’ and ‘Australia’.

var pivotColumns = new List<string>();
pivotColumns.AddRange(new string[] { "Canada", "Australia" });
this.pivotGridControl1.TableControl.CollapseColumn(pivotColumns);
Dim pivotColumns = New List(Of String)()
pivotColumns.AddRange(New String() {"Canada", "Australia"})
Me.pivotGridControl1.TableControl.CollapseColumn(pivotColumns)

Events

  • The Collapsing event occurs while collapsing the pivot item header. This event receives an argument namely CollapsingEventArgs, which contains the information about the collapsing pivot item.

  • The Collapsed event occurs when the pivot item header is collapsed. This event receives an argument namely CollapsedEventArgs, which contains the information about the expanded pivot item.

Expanding headers

Pivot grid supports to drill down the pivot item with the help of row headers and column headers. To expand either all the headers or specific headers, built-in methods are available in pivot grid.

Expanding all headers

Both the row and column headers can be expanded simultaneously by using the ExpandAllGroups method.

Refer to the below code sample to expand all the headers including row headers and column headers.

this.pivotGridControl1.TableControl.ExpandAllGroups();
Me.pivotGridControl1.TableControl.ExpandAllGroups()

Expanding all row headers

All the row headers can be expanded by using the ExpandAllRowGroups method.

Refer to the below code sample to expand all the row headers.

this.pivotGridControl1.TableControl.ExpandAllRowGroups();
Me.pivotGridControl1.TableControl.ExpandAllRowGroups()

Expanding all column headers

All the column headers can be expanded by using the ExpandAllColumnGroups method.

Refer to the below code sample to expand all the column headers.

this.pivotGridControl1.TableControl.ExpandAllColumnGroups();
Me.pivotGridControl1.TableControl.ExpandAllColumnGroups()

Expanding specific headers

Expanding specific row header

Specific row header can be expanded by specifying the name of corresponding pivot row item in the ExpandRow method.

Refer to the below code sample to expand the pivot row item which specifies ‘Bike’.

this.pivotGridControl1.TableControl.ExpandRow("Bike");
Me.pivotGridControl1.TableControl.ExpandRow("Bike")

Expanding specific column header

Specific column header can be expanded by specifying the name of corresponding pivot column item in the ExpandColumn method.

Refer to the below code sample to expand the pivot column item which specifies ‘Canada’.

this.pivotGridControl1.TableControl.ExpandColumn("Canada");
Me.pivotGridControl1.TableControl.ExpandColumn("Canada")

Expanding collection of row headers

The collection of row headers can be expanded by specifying the list of pivot row item’s names in the ExpandRow method.

Refer to the below code sample to expand the pivot row items of ‘Bike’ and ‘Car’.

var pivotRowItems = new List<string>();
pivotRows.AddRange(new string[] { "Bike", "Car"});
this.pivotGridControl1.TableControl.ExpandRow(pivotRowItems);
Dim pivotRowItems = New List(Of String)()
pivotRows.AddRange(New String() {"Bike", "Car"})
Me.pivotGridControl1.TableControl.ExpandRow(pivotRowItems)

Expanding collection of column headers

The collection of column headers can be expanded by specifying the list of pivot column item’s names in the ExpandColumn method.

Refer to the below code sample to expand the pivot column items of ‘Canada’ and ‘Australia’.

var pivotColumnItems = new List<string>();
pivotColumns.AddRange(new string[] { "Canada", "Australia" });
this.pivotGridControl1.TableControl.ExpandColumn(pivotColumnItems);
Dim pivotColumnItems = New List(Of String)()
pivotColumns.AddRange(New String() {"Canada", "Australia"})
Me.pivotGridControl1.TableControl.ExpandRow(pivotColumnItems)

Events

  • The Expanding event occurs while expanding the pivot item header. This event receives an argument namely ExpandingEventArgs, which contains the information about the expanding pivot item.

  • The Expanded event occurs when the pivot item header is expanded. This event receives an argument namely ExpandedEventArgs, which contains the information about the expanded pivot item.

A demo sample is available in the following location.

<Installed Drive>\Users\Public\Documents\Syncfusion\Windows\<Version Number>\PivotGrid.Windows\Samples\Product Showcase\Customization Demo