title: Retain the user defined sort order in WPF DataGrid
body: <p>I have a WPF DataGrid that is populated with data from DataSet. I have <code>CanUserSortColumns</code> set to <strong>true</strong>.</p>
  
  <p>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 </p>
  
  <pre><code>  object selectedItem = dgInvoiceHeads.SelectedItem;
  </code></pre>
  
  <p>before the refresh takes place and then placing </p>
  
  <pre><code> dgInvoiceHeads.SelectedItem = selectedItem;
  </code></pre>
  
  <p>after the refresh takes place. </p>
  
  <p>But I can't seem to get it to retain the specified sort.</p>