title: WPF datagrid won't sort despite setting CanUserSort and SortMemberPath
body: <p>I have a DataGrid with an ItemSource set to an array of objects. The template column is set to a checkbox which is bound to the boolean IsChecked, and the rest of the columns are text columns set to strings. Despite setting SortMemberPaths and CanUserSort on the text columns, I'm still unable to sort any columns in the header. Any thoughts? Thanks in advance.</p>
  
  <p><strong>ItemSource Object</strong></p>
  
  <pre><code>public class MyAllergy
  {
      public string Allergen { get; set; }
      public string AllergenType { get; set; }
      public string AllergyType { get; set; }
      public string Reactions { get; set; }
      public string TouchedWhen { get; set; }
      public Boolean IsChecked { get; set; }
      public Boolean IsEnabled { get; set; }
      public string ApplicationSourceName { get; set; }
      public string AllergyCategory { get; set; }
      public string ConfidenceLevel { get; set; }
      public PartialDate OnsetDate { get; set; }
      public string Status { get; set; }
      public string CreatedWhen { get; set; }
      public string InformationSource { get; set; }
      public string Text { get; set; }
      public string ConfirmedBy { get; set; }
      public long AllergyGUID { get; set; }
  }
  </code></pre>
  
  <p><strong>XAML</strong></p>
  
  <pre><code>      &lt;DataGrid AlternatingRowBackground="#FFCDDAEB" AutoGenerateColumns="False" Background="White" Height="160" HorizontalAlignment="Stretch" Margin="18,355,6,0" Name="dgUnityAllergies" VerticalAlignment="Top" Width="704" CanUserAddRows="false" FontSize="12"&gt;
              &lt;DataGrid.Columns&gt;
                  &lt;DataGridTemplateColumn&gt;
                      &lt;DataGridTemplateColumn.HeaderTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;CheckBox x:Name="all" Click="SelectAllCheckBox_Click" IsChecked="{Binding IsChecked}"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGridTemplateColumn.HeaderTemplate&gt;
                      &lt;DataGridTemplateColumn.CellTemplate&gt;
                          &lt;DataTemplate&gt;
                              &lt;CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsEnabled}"/&gt;
                          &lt;/DataTemplate&gt;
                      &lt;/DataGridTemplateColumn.CellTemplate&gt;
                  &lt;/DataGridTemplateColumn&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Category" Width ="Auto" Binding="{Binding AllergyCategory}" IsReadOnly="True" SortMemberPath="AllergyCategory"/&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Type" Width ="Auto" Binding="{Binding AllergenType}" IsReadOnly="True" SortMemberPath="AllergenType"/&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Allergen" Width ="Auto" Binding="{Binding Allergen}" IsReadOnly="True" SortMemberPath="Allergen"/&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Campus" Width ="Auto" Binding="{Binding ApplicationSourceName}" IsReadOnly="True" SortMemberPath="ApplicationSourceName"/&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Reactions" Width ="*" Binding="{Binding Reactions}" IsReadOnly="True" SortMemberPath="Reactions"/&gt;
                  &lt;DataGridTextColumn CanUserSort="True" Header="Entered On" Width ="Auto" Binding="{Binding TouchedWhen}" IsReadOnly="True" SortMemberPath="TouchedWhen"/&gt;
              &lt;/DataGrid.Columns&gt;
          &lt;/DataGrid&gt;
  </code></pre>