DataGrid for WPF and Silverlight Overview > DataGrid Features > Grouping |
You can enable grouping and the grouping area of the grid so that users can group columns in your grid at run time to better organize information. For more information, see Grouping Columns. By default, user cannot group columns in the grid but you can enable this function by setting the C1DataGrid.CanUserGroup property to True.
At Design Time
To enable grouping, complete the following steps:
In XAML
For example to enable grouping, add CanUserGroup="True" to the < c1:C1DataGrid> tag so that it appears similar to the following:
<c1:C1DataGrid Name="c1datagrid1" Height="180" Width="250" CanUserGroup=True" />
In Code
For example, to enable grouping, add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
Me.C1DataGrid1.CanUserGroup = True |
C# |
Copy Code
|
---|---|
this.c1DataGrid1.CanUserGroup = true; |
What You've Accomplished
Run the application and notice that the grouping area appears at the top of the grid. Note that you can also customize the visibility of the grouping area. For more information about the grouping area, see the Showing the Grouping Area topic.