'Declaration Public Sub CollapseGroupsToLevel( _ ByVal level As System.Integer _ )
public void CollapseGroupsToLevel( System.int level )
Parameters
- level
- Grouping level to show.
'Declaration Public Sub CollapseGroupsToLevel( _ ByVal level As System.Integer _ )
public void CollapseGroupsToLevel( System.int level )
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 GroupRow.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 CollapseGroupsToLevel(0) would collapse all top-level group rows, showing only the first level of the grouping outline. CollapseGroupsToLevel(2) would show all the group rows, and no data rows. CollapseGroupsToLevel(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 PagedCollectionView(dataList); var gd = view.GroupDescriptions; gd.Add(new PropertyGroupDescription("Country")); gd.Add(new PropertyGroupDescription("City")); gd.Add(new PropertyGroupDescription("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.CollapseGroupsToLevel(1); // expand grouping outline show all detail _flex.CollapseGroupsToLevel(gd.Count); // collapse grouping outline to show all group rows and no detail _flex.CollapseGroupsToLevel(gd.Count - 1);
// create grouped data source var view = new PagedCollectionView(dataList); var gd = view.GroupDescriptions; gd.Add(new PropertyGroupDescription("Country")); gd.Add(new PropertyGroupDescription("City")); gd.Add(new PropertyGroupDescription("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.CollapseGroupsToLevel(1); // expand grouping outline show all detail _flex.CollapseGroupsToLevel(gd.Count); // collapse grouping outline to show all group rows and no detail _flex.CollapseGroupsToLevel(gd.Count - 1);