title: Making a DataGrid Column Header sortable in WPF using C#
body: <p>I am using C# in  Visual Studio 2008 and I have install the WPF Toolkit.  I created a DataGrid in testtest.xaml.  The ID and Parts $ columns have the ability to sort the DataGrid by clicking on their respecteive column headers.  However, the column header Complete Date does not have that ability. I used the tag "DataGridTemplateColumn" to format the dates for this column.  How do you program the column header Complete Date so you can click on the Complete Date column header and sort that column.  If you click on the column, the arrow is not only not displayed but the column header is not "clickable".
  Thank you</p>
  
  <p>
      </p>
  
  <pre><code>    &lt;Label Height="22" HorizontalAlignment="Left" Margin="10,45,0,0" Name="label1" VerticalAlignment="Top" Width="41"&gt;Task&lt;/Label&gt;
      &lt;my:DataGrid ItemsSource="{Binding}" AutoGenerateColumns="False" Margin="140,83,67,28" Name="dataGrid1" GridLinesVisibility="Vertical" IsReadOnly="True"&gt;
          &lt;my:DataGrid.Columns&gt;
              &lt;my:DataGridTextColumn    Binding="{Binding Path=[ID]}" Header="ID" /&gt;
              &lt;my:DataGridTextColumn Binding="{Binding Path=p}" Header="Parts $" /&gt;
              &lt;my:DataGridTemplateColumn  SortMemberPath="" Header="Complete Date"&gt;
                  &lt;my:DataGridTemplateColumn.CellTemplate &gt;
                      &lt;DataTemplate&gt;
                          &lt;TextBlock&gt;
                              &lt;TextBlock.Text&gt;
                                  &lt;Binding Path="CompleteDate" ConverterCulture="en-GB" StringFormat="{}{0:MM/dd/yyyy}"/&gt;
                              &lt;/TextBlock.Text&gt;
                          &lt;/TextBlock&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/my:DataGridTemplateColumn.CellTemplate&gt;
              &lt;/my:DataGridTemplateColumn&gt;
          &lt;/my:DataGrid.Columns&gt;
      &lt;/my:DataGrid&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>