[]
Collapses the groups.
public void CollapseGroups(int level = 0)
Type | Name | Description |
---|---|---|
int | level | Grouping level to show. |
When the grid is bound to a grouped data source, it automatically adds group rows above each group. Individual group rows can be collapsed or expanded using the IsCollapsed property.
This method allows the caller to expand or collapse the entire outline to a given level.
For example, if the grid is bound to a data source with three group descriptors, then CollapseGroups(0) would collapse all top-level group rows, showing only the first level of the grouping outline. CollapseGroups(2) would show all the group rows, and no data rows. CollapseGroups(3) would show all rows (groups and detail).
// create grouped data source
var view = new C1DataCollection(dataList);
var gd = view.GroupDescriptions;
await view.GroupAsync("Country", "City", "Customer");
// assign data source to grid
_flex.ItemsSource = view;
// collapse grouping outline to level 1
// (show country and city groups, hide customer groups and all detail rows)
_flex.CollapseGroups(1);
// expand grouping outline show all detail
_flex.CollapseGroups(gd.Count);
// collapse grouping outline to show all group rows and no detail
_flex.CollapseGroups(gd.Count - 1);