Parameters
- 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 GridGroupRow.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).
The code below creates data source with three levels of grouping, then shows the first two levels of the grouping outline:// 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);
// 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);