title: WPF4 Datagrid doesn't sort on column headers
body: <p>I am trying to implement my first WPF application using an MVVM design pattern.</p>
  
  <p>I created an application that is databinding to an ObservableCollection&lt;>.  The application renders fine, but I expect the datagrid to re-sort the rows when I click on the column headers.</p>
  
  <p>I've researched posts that said:
  The data source has to implement IEnumerable, mine does.
  I need to set CanUserSortColumns and/or CanUserSort (on each column), I did.
  I could implement a custom sort by specifying the Sorting callback function, I did.</p>
  
  <p>None of these seem to have helped. In the debugger, my _customerGrid_Sorting function never gets called and clicking on the column headers has no effect.</p>
  
  <p>Am I missing something in the XAML that follows? Is there another interface I need to implement?  I am feeling very lost right now, so any help is appreciated.</p>
  
  <p>XAML:</p>
  
  <pre><code>        &lt;DataGrid Name="_customerGrid" 
              AutoGenerateColumns="False" 
              CanUserSortColumns="True"
              ColumnHeaderStyle="{StaticResource columnHeaderStyle}"
              HorizontalAlignment="Left" 
              ItemsSource="{Binding Path=AllCustomers}" 
              RowDetailsVisibilityMode="VisibleWhenSelected"
              RowStyle="{StaticResource DataGridRowStyle}"
              SelectionUnit="FullRow"
              Sorting="_customerGrid_Sorting"
              VerticalAlignment="Top"&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTemplateColumn Header="Cust ID" MinWidth="90" CanUserSort="True" &gt;
                      &lt;DataGridTemplateColumn.CellTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;Label Content="{Binding Path=CustID}" /&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGridTemplateColumn.CellTemplate&gt;
                  &lt;/DataGridTemplateColumn&gt;
                  &lt;DataGridTemplateColumn Header="Name" MinWidth="300" CanUserSort="True" Width="*"&gt;
                      &lt;DataGridTemplateColumn.CellTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;Label Content="{Binding Path=Name}" /&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGridTemplateColumn.CellTemplate&gt;
                  &lt;/DataGridTemplateColumn&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
  </code></pre>