PivotGridControl.CustomGroupInterval Event

Allows you to custom group values of a column and a row field.

Namespace: DevExpress.Xpf.PivotGrid

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


public event PivotCustomGroupIntervalEventHandler CustomGroupInterval

Event Data

The CustomGroupInterval event's data class is PivotCustomGroupIntervalEventArgs. The following properties provide information specific to this event:

Property Description
Field Gets the field being processed.
GroupValue Gets or sets a group value.
ThreadSafeField Gets the field being processed. Provides read-only access to field settings.
Value Gets the processed field value.


Values of column and row fields can be grouped into larger ranges. You can select one of the predefined group modes available via the PivotGridField.GroupInterval property. If none of these group modes match your requirements, you can implement custom grouping.

To custom group a field’s values, set the PivotGridField.GroupInterval property to Custom and handle the CustomGroupInterval event to implement custom grouping logic. The event fires for each value of a field. While handling the event, use the PivotCustomGroupIntervalEventArgs.GroupValue parameter to specify the group that will own the currently processed value. For values to be displayed in a single group, provide the same value for the GroupValue parameter.

Objects assigned to the GroupValue property must be of the same type for all values of a particular field.


The CustomGroupInterval event is not supported in server and OLAP mode.


This example shows how to implement custom Group Intervals.

View Example

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.OleDb
Imports System.Windows
Imports DevExpress.Xpf.PivotGrid
Imports HowToBindToMDB.NwindDataSetTableAdapters
Imports System

Namespace HowToBindToMDB
    ''' <summary>
    ''' Interaction logic for MainWindow.xaml
    ''' </summary>
    Partial Public Class MainWindow
        Inherits Window
        Private salesPersonDataTable As New NwindDataSet.SalesPersonDataTable()
        Private salesPersonDataAdapter As New SalesPersonTableAdapter()

        Public Sub New()
            pivotGridControl1.DataSource = salesPersonDataTable
        End Sub

        Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
        End Sub

        Private Sub pivotGridControl1_CustomGroupInterval(ByVal sender As Object, _
                                                          ByVal e As PivotCustomGroupIntervalEventArgs)
            If (Not Object.ReferenceEquals(e.Field, fieldProductGroup)) Then
            End If
            Dim productName As String = Convert.ToString(e.Value)
            If productName.Chars(0) < "F"c Then
                e.GroupValue = "A-E"
            ElseIf productName.Chars(0) > "E"c AndAlso productName.Chars(0) < "T"c Then
                e.GroupValue = "F-S"
            ElseIf productName.Chars(0) > "S"c Then
                e.GroupValue = "T-Z"
            End If
        End Sub
    End Class
End Namespace
See Also