Features / Data Grouping
Data Grouping

FlexGrid supports data grouping through DataCollection, as well as separately through UI, which is shipped under a separate assembly, C1.WPF.FlexGridGroupPanel. FlexGridGroupPanel is available as a separate control to keep the footprint of FlexGrid control. This section discusses grouping data over a column.

To group data over a column using FlexGrid's internal collection, you can use the following code. This example uses the sample created in Quick Start topic. In this example, GroupDescriptions property is used to group the data by adding an object of the PropertyGroupDescription class to the collection. This class describes the grouping of items using a property name ("Country" property in this case) as the criterion.

 WPF FlexGrid grouping

C#
Copy Code
//group grid's Collection for Country property
grid.CollectionView.GroupDescriptions.Add(new PropertyGroupDescription("Country"));

In addition, data can be grouped in FlexGrid using the following two approaches discussed in the following topics.