Christian Findlay
Christian Findlay

Reputation: 7702

Xamarin Forms - Equivalent of CollectionViewSource

In WPF and other XAML based technologies there was a class called CollectionViewSource. It was useful because rather than filtering and sorting inline etc. one would put a layer over the top of the actual collection, and only expose the sorted/filtered view to the UI. This meant that the model would stay clean while the UI could sort or filter. Is there an equivalent in Xamarin Forms?

The List<> class has a sort method which would be perfect. But, List<> doesn't implement INotifyCollectionChanged. Is there a List that implements INotifyCollectionChanged and a Sort method?

Upvotes: 7

Views: 3102

Answers (2)

r2d2rigo
r2d2rigo

Reputation: 813

This is one of the features I have always found lacking in Xamarin Forms and, while a few issues were raised and requests made, it is still missing from XF as of version 4.8

I went ahead and made a partial port (only supports filtering and sorting as of now) of WPF's CollectionView which can be found at

https://www.nuget.org/packages/CollectionViewSource.Forms/

It is open source, so any issues or improvements can be filed at

https://github.com/rotorsoft-ltd/CollectionViewSource.Forms/

Upvotes: 2

Christian Findlay
Christian Findlay

Reputation: 7702

There is no equivalent. The feature has been requested here:

https://github.com/xamarin/Xamarin.Forms/issues/2193

Please comment your thoughts on the Github issue so that the Xamarin Forms team knows that this is important.

Upvotes: 7

Related Questions