I have a WPF DataGrid that is populated with data from DataSet. I have CanUserSortColumns set to true.

Is it possible to retain the sorting that the user specified when the grid is refreshed? I have it retaining the item that was selected using

  object selectedItem = dgInvoiceHeads.SelectedItem;

before the refresh takes place and then placing

 dgInvoiceHeads.SelectedItem = selectedItem;

after the refresh takes place.

But I can't seem to get it to retain the specified sort.

Edit
Report