The purpose of this article is to sort data displayed in datagrid in ascending or descending direction and reverses the direction of the sort automatically each time user clicks the column in datagrid. This article is divided into two parts. The first part uses sortexpression property of the column for sorting and the latter part uses dynamic attributes property of datagrid and dataview class for sorting.
- This kind of sorting can be applied to any number of desired columns you want data to be sorted.
- It reverses the sort direction each time automatically for each column.