title: WPF DataGrid (In .NET 4.0 Not Toolkit), Header Sorting with ICollectionView
body: <p><em>Firstly let me clarify (if the title wasn't clear enough): I'm discussing <code>System.Windows.Controls.DataGrid</code> from the .NET 4.0 Framework, <strong>not</strong> the toolkit edition.</em></p>
  
  <p>I'm currently building up a small re-usable set of classes/view models/etc in my project to build a rather powerfull DataGrid for my application. </p>
  
  <p>Now, by default given an <code>IEnumarable&lt;&gt;</code> ItemsSource the DataGrid control supports header-clicking column sorting.</p>
  
  <p>However, my implementation now uses a <code>CollectionViewSource</code> and <code>ICollectionView</code> to expose data members to the DataGrid. When hooked up in this fashion it seems to rely on the SortDescriptions to sort.</p>
  
  <p>While I like having control from code (could be hooked into all sorts of things) I also require the ability for my users to click the header bars to sort thier results. I'm looking for a way to hook the header-bar clicks to signal my code to adjust the <code>CollectionViewSource</code> appropriately.</p>
  
  <ol>
  <li>Am I going to have to re-style the header buttons to do fire the events? </li>
  <li>Is there a way to hook the sort events from the DataGrid control's existing headers? </li>
  <li>What is the best way to go about this? </li>
  <li>Am I using <code>ICollectionView</code> incorrectly?</li>
  </ol>