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

PivotGridField.Group Property

Gets or sets the group which owns the current field. This is a dependency property.

Namespace: DevExpress.Xpf.PivotGrid

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

Declaration

public PivotGridGroup Group { get; set; }

Property Value

Type Description
PivotGridGroup

A PivotGridGroup object which owns the current field; null if the field doesn’t belong to a group.

Remarks

Multiple fields can be combined into a single group via the PivotGridControl.Groups collection. Fields that belong to the same group cannot be separated and they are always dragged as a whole. Linked fields are displayed within the same area which is specified by the PivotGridGroup.Area property.

Example

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

In this example, three fields (“Country”, “Region” and “City”) are combined in a new group, in this order. This ensures that the “Country” field is followed by “Region”, which is in turn followed by “City”. If the “Region” field is dragged to another area, the other fields accompany it.

Note

A complete sample project is available at https://github.com/DevExpress-Examples/how-to-group-fields-e2129.

using System.Windows;
using DevExpress.Xpf.PivotGrid;
using HowToBindToMDB.NwindDataSetTableAdapters;

namespace HowToBindToMDB {
    public partial class MainWindow : Window {
        NwindDataSet.SalesPersonDataTable salesPersonDataTable = 
            new NwindDataSet.SalesPersonDataTable();
        SalesPersonTableAdapter salesPersonDataAdapter = new SalesPersonTableAdapter();
        public MainWindow() {
            InitializeComponent();
            pivotGridControl1.DataSource = salesPersonDataTable;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e) {
            salesPersonDataAdapter.Fill(salesPersonDataTable);

            // Create a group at run-time
            PivotGridGroup group = pivotGridControl1.Groups.Add(fieldCategoryName, fieldProductName);
        }
    }
}

The following code snippets (auto-collected from DevExpress Examples) contain references to the Group property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also