Does anyone know why I'm getting a NullReference Expception at following line:
var field = (string)((Binding)((GridViewColumnHeader)e.OriginalSource).Column.DisplayMemberBinding).Path.Path;
when using this example: http://www.switchonthecode.com/comment/reply/263/2980 (based on: http://www.switchonthecode.com/tutorials/wpf-tutorial-using-the-listview-part-2-sorting)
Thanks a lot!
Cheers, Joseph
PS: This only happens when I'm sorting double/decimals, not for strings?
EDIT:
I found the problem. This is how my XAML looks like:
<GridViewColumn Header="Double">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding TotalValues, Mode=OneWay, StringFormat=\{0:0\'0.00\}, Converter={StaticResource GridValueConverter}}" TextAlignment="Right" Width="auto"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="Comments" DisplayMemberBinding="{Binding Path=Comments, Mode=OneWay}" Width="auto"/>
The problem here is that I'm trying to get the DisplayMemberBinding, but for the double's I'm using a DataTemplate.. does anyone know how I can change the line to make it work for every Column-Type?