Collapses all the group rows to a given level.
Namespace:
C1.Silverlight.FlexGridAssembly: C1.Silverlight.FlexGrid.4 (in C1.Silverlight.FlexGrid.4.dll)
Syntax
C# |
---|
public void CollapseGroupsToLevel( int level ) |
Visual Basic |
---|
Public Sub CollapseGroupsToLevel ( _ level As Integer _ ) |
Parameters
- level
- Type: System..::..Int32
Grouping level to show.
Remarks
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 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).
Examples
The code below creates data source with three levels of grouping, then
shows the first two levels of the grouping outline:
Copy CodeC#

// 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); |