I'm having some problem figuring out which listview column header was clicked on. In the XAML, I have this:
ListView Name="myListView" ItemsSource="{Binding MyItemList}" GridViewColumnHeader.Click="ListView_Click"
And once there is a click on the column header, I handle it like this:
private void ListView_Click(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
string header = headerClicked.Column.Header as string;
[...]
This is how I've seen sorting by column done in many samples. After this I use the header to figure out which column to sort by, and do the sorting.
My problem is that headerClicked.Column.Header is the displayed name of the column header, which is different for different languages. Is there a way to get some other type of identifier which is not display/language dependant instead of relying on the "header" string?
Thanks!