wpf-96451-controls-and-libraries-data-grid-getting-started-code-lesson-4-manage-data.md
This tutorial demonstrates how to sort data in the GridControl, group data against a column, and create filters. The tutorial is based on Lesson 3.
You can use the GridControl to sort data. The code sample below sorts data against the Order Date and Customer Id columns:
<dxg:GridColumn FieldName="CustomerId" SortIndex="1" SortOrder="Ascending"/>
<dxg:GridColumn FieldName="OrderDate" SortIndex="0" SortOrder="Descending"/>
Refer to the following help topic for information on how users can sort data: Sort Data.
You can use the GridControl to group data. The code sample below groups data against the Ship Country and Ship City columns:
Specify the GridColumn.GroupIndex property for the Ship Country and Ship City columns to group data against them and set the group priority:
<dxg:GridColumn FieldName="ShipCity" GroupIndex="1"/>
<dxg:GridColumn FieldName="ShipCountry" GroupIndex="0"/>
Refer to the following help topic for information on how users can group data: Grouping.
You can use the GridControl to filter data. The code sample below applies a filter to display records from the beginning of 2020 with freight over $100.00:
Specify the DataControlBase.FilterString property with a filter expression:
<dxg:GridControl FilterString="[OrderDate] > #2020-01-01# And [Freight] > 100" ...>
Refer to the following help topic for information on how users can filter data: Filter Data.
See Also