'Declaration
Public Property GroupDescriptions As IList(Of GroupDescription)
public IList<GroupDescription> GroupDescriptions {get; set;}
'Declaration
Public Property GroupDescriptions As IList(Of GroupDescription)
public IList<GroupDescription> GroupDescriptions {get; set;}
The GroupDescriptions property is similar to the GroupDescriptions property available in the XAML and JavaScript versions of the FlexGrid.
Each group description also specifies a sort direction for the property. For example, if you group the data by Country, the grid will sort the data by country before creating the groups.
Grouping works best when the DataSource can be sorted by multiple properties (System.ComponentModel.IBindingListView). This is the case for System.Data.DataTable sources. If you want to group lists of arbitrary objects, use the SortableBindingList<T> class.
For example:
var list = new List<MyDataObject>(); for (var i = 0; i < 100; i++) { list.Add(new MyDataObject(i)); } grid.DataSource = new SortableBindingList<MyDataObject>(list); grid.GroupDescriptions = new List<GroupDescription>() { new GroupDescription("Country"), new GroupDescription("Product"), };
The GroupDescriptions property uses the grid's Subtotal(AggregateEnum) method to create and update the groups when the data is modified.