Back to Devexpress

PivotGridGroupCollection Class

corelibraries-devexpress-dot-xtrapivotgrid-a9e903ba.md

latest3.6 KB
Original Source

PivotGridGroupCollection Class

Represents a collection of field groups.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.PivotGrid.v25.2.Core.dll

NuGet Packages : DevExpress.PivotGrid.Core, DevExpress.Win.Navigation

Declaration

csharp
[ListBindable(false)]
public class PivotGridGroupCollection :
    CollectionBase
vb
<ListBindable(False)>
Public Class PivotGridGroupCollection
    Inherits CollectionBase

The following members return PivotGridGroupCollection objects:

Remarks

The XtraPivotGrid allows its fields to be arranged into groups. The collection of such groups can be accessed via the PivotGridControl.Groups property. Each group holds the fields in its PivotGridGroup.Fields collection.

PivotGridGroupCollection members allow you to add, remove, access individual groups and, perform other common collection management tasks.

Example

The following example demonstrates how to combine fields into a group.

In the example three fields (‘Country’, ‘Region’ and ‘City’) are combined into a new group in that order. This ensures that the ‘Country’ field will be followed by ‘Region’ which is in turn followed by ‘City’. If the ‘Region’ field is being dragged to another area the other fields will be dragged as well. The following image shows the ‘Region’ field being dragged to the Filter Header Area.

csharp
using DevExpress.XtraPivotGrid;

PivotGridField fieldCountry = pivotGridControl1.Fields["Country"];
PivotGridField fieldRegion = pivotGridControl1.Fields["Region"];
PivotGridField fieldCity = pivotGridControl1.Fields["City"];
// Add a new group which combines the fields.
pivotGridControl1.Groups.Add(new PivotGridField[] {fieldCountry, fieldRegion, fieldCity});
vb
Imports DevExpress.XtraPivotGrid

Dim fieldCountry As PivotGridField = PivotGridControl1.Fields("Country")
Dim fieldRegion As PivotGridField = PivotGridControl1.Fields("Region")
Dim fieldCity As PivotGridField = PivotGridControl1.Fields["City")
' Add a new group which combines the fields.
PivotGridControl1.Groups.Add(new PivotGridField() {fieldCountry, fieldRegion, fieldCity})

Inheritance

Object CollectionBase PivotGridGroupCollection PivotGridWebGroupCollection

MVCxPivotGridWebGroupCollection

See Also

PivotGridGroupCollection Members

Field Groups

DevExpress.XtraPivotGrid Namespace