How can I sort a DataGridTemplateColumn on a WPF Toolkit DataGrid?
You need to set the SortMemberPath
property on Controls:DataGridTemplateColumn
to the name of the CLR property you want to sort on.
Added SortMemberPath="Name"
to DataGridTemplateColumn. It started sorting.
<data:DataGridTemplateColumn Header="Name" SortMemberPath="Name" CanUserSort="True">
<DataGridTemplateColumn SortMemberPath="DataDiNascita" Header="Data di nascita" IsReadOnly="True">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding Path=DataDiNascita}"></DatePicker>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=DataDiNascita,StringFormat=\{0:dd/MM/yyyy\}}"></TextBlock>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>