DataGrid for WPF and Silverlight Overview > DataGrid Features > Grouping > Grouping Columns |
Users can group columns in your grid at run time to better organize information. The grouping area at the top of the grid allows you to easily group columns through a simple drag-and-drop operation:
To group a column, drag a column header onto the grouping area:
You can sort the display of grouped items, by clicking the column header in the grouping area. In the following image the grouped column has been reverse sorted:
You can group multiple columns by performing a drag-and-drop operation to drag additional columns to the grouping area:
To remove the grouping, simply click the X button next to a grouped column in the grouping area of the grid:
Note that the CanUserGroup property must be set to True for the grouping area to be visible and grouping to be possible (by default it is set to False). For more information, see Enabling Grouping in the Grid. For more information about showing the grouping area, see the Showing the Grouping Area topic.