Search code examples
c#wpfdatagrid

How to programmatically sort an autogenerated column in wpf datagridview?


I used an List<T> as source. The columns are auto generated. I can sort it in List. But I want to sort programmatically, Lets say 3rd column of data-grid view. How can I do it?


Solution

  • For a WPF DataGrid, check this out: http://social.msdn.microsoft.com/Forums/en/wpf/thread/5d3942c8-e3e1-4284-b1b3-0b8b94150d86.

    The Winforms DataGridView has two Sort methods, one which will specify a particular column, and another which will take an IComparer of DataGridViewRows. Documentation.