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

In This Topic
    GroupDescriptions Property (C1FlexGrid)
    In This Topic
    Gets or sets a collection of 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 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 C1FlexGridBase.Subtotal method to create and update the groups when the data is modified.

    See Also