Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CollectionViewSource with custom sort

Tags:

I'm new to WPF and I'm having difficulty trying to sort a CollectionViewSource with a custom sort. Here's the situation:

I have a SearchView that is called with a parameter which becomes it's datacontext like so:

mainView.SetGlobalOverlay(New SearchView With {.DataContext = interventionViewModel})

In the SearchView.xaml, I then bind the CollectionViewSource to the collection :

<CollectionViewSource x:Key="UnitsCollection"
                          Filter="UnitsCollection_Filter"
                          Source="{Binding Path=Units}" />

Now, I already have an IComparer interface implemented in another shared class. This comparer is used on a ListCollectionView somewhere else in the sourcecode and works fine. Now, how can I re-use this comparer on a CollectionViewSource?