An IComparerentire object will be provided in your implementation , you need to figure out which column is clicked, perhaps by doing something like this:
this.AddHandler(GridViewColumnHeader.ClickEvent,
new RoutedEventHandler(Column_Sort));
and then load it into MyComparer, perhaps by modifying your constructor to go along the property path.
In Column_Sortyou can get the property path something like this (I'm a little rusty on vb, but C # would do this:
void Column_Sort(object sender, RoutedEventArgs e)
{
var memberBinding= ((GridViewColumnHeader)e.OriginalSource).Column.DisplayMemberBinding;
var path = ((Binding)memberBinding).Path.Path;
}
and then enter this into the sorting logic.
Dim view As ListCollectionView = CollectionViewSource.GetDefaultView(myCollection)
Using view.DeferRefresh
view.SortDescriptions.Clear()
view.SortDescriptions.Add(New SortDescription(sortHeader.Header, direction))
view.SortDescriptions.Add(New SortDescription(otherColumn, direction))
view.CustomSort = New MyComparer(PropertyPath)
End Using
EDIT:
IComparer , google , , ASC/DESC :
User.LastName DESC, User.FirstName DESC
, , Ctrl. , ListView GridViewColumnHeader KeyDown, , , IComparer .