FlexGrid for WinForms | ComponentOne
C1.Win.C1FlexGrid.Classic Namespace / C1FlexGridClassic Class / GroupDescriptions Property

In This Topic
    GroupDescriptions Property (C1FlexGridClassic)
    In This Topic
    Gets or sets a collection of C1.Win.C1FlexGrid.GroupDescription objects that describe how items in the data source are grouped in the grid.
    Syntax
    'Declaration
     
    
    Public Property GroupDescriptions As IList(Of GroupDescription)
    public IList<GroupDescription> GroupDescriptions {get; set;}
    Remarks

    The C1.Win.C1FlexGrid.C1FlexGridBase.GroupDescriptions property is similar to the C1.Win.C1FlexGrid.C1FlexGridBase.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 C1.Win.C1FlexGrid.C1FlexGridBase.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 C1.Win.C1FlexGrid.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 C1.Win.C1FlexGrid.C1FlexGridBase.GroupDescriptions property uses the grid's Subtotal(AggregateEnum) method to create and update the groups when the data is modified.

    See Also