DataGrid for WPF and Silverlight Overview > DataGrid Features > Grouping > Showing the Grouping Area |
By default grouping in the grid is disabled and the grouping area is not visible. For more information, see Grouping Columns. When the CanUserGroup property is set to True and grouping is enabled the grouping area is made visible. But if you choose you can show or hide the grouping area whether or not grouping is enabled. By default, the grouping area is not visible when grouping is not enabled but you can make the area visible by setting the ShowGroupingPanel property to True.
At Design Time
To show the grouping area, complete the following steps:
In XAML
For example to show the grouping area, add ShowGroupingPanel="True" to the <c1:C1DataGrid> tag so that it appears similar to the following:
<c1:C1DataGrid Name="c1DataGrid1" Height="180" Width="250" ShowGroupingPanel="True" />
In Code
For example, to show the grouping area, add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
Me.C1DataGrid1.ShowGroupingPanel = True |
C# |
Copy Code
|
---|---|
this.c1DataGrid1.ShowGroupingPanel = true; |
What You've Accomplished
Run the application and notice that the grouping area appears at the top of the grid. Note that even if the grouping area is visible, grouping will not be enabled if the CanUserGroup property is False. For more information, see the Enabling Grouping in the Grid topic.