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.v20.1.dll

Declaration

public PivotGridGroup Group { get; set; }
Public Property Group As PivotGridGroup

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.

Examples

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

In this example, two fields ("Country" and "Customer") are combined into a new group at design time, and another two fields ("Category" and "Product") are combined into a new group at runtime, in this order. This ensures that the "Country" field is followed by "Customer", and the the "Category" field is followed by "Product". If you drag the "Region" field and drop it to another area, the "Customer" field accompanies it. This behavior is also true for the second group.

NOTE

A complete sample project How to: Group Fields is available at GitHub.

using System.Windows;
using DevExpress.Xpf.PivotGrid;
using HowToBindToMDB.DataSet1TableAdapters;
using static HowToBindToMDB.DataSet1;

namespace HowToBindToMDB {
    public partial class MainWindow : Window {
        SalesPersonDataTable salesPersonDataTable = 
            new 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);
        }
    }
}
See Also