I have two advanced collection views from windows community toolkit and both of them are bound to same ObservableCollection with different filters and sorting, basically in one of them I need to show just the recent and limited number of items. How can I achieve that?
PeoplePrivate = new ObservableCollection<Person>();
var People = new AdvancedCollectionView(PeoplePrivate, true) { Filter = x => true };
People.SortDescriptions.Add(new SortDescription(nameof(Person.Name), SortDirection.Ascending));
var RecentPeople = new AdvancedCollectionView(PeoplePrivate, true) { Filter = x => true };
RecentPeople.SortDescriptions.Add(new SortDescription(nameof(Person.Modified), SortDirection.Descending));
As you can see in the code above recentPeople should only show recent 20 people according to the modified date. There doesn't seem to be any property to set max size on the advancedCollection view or do anything like "Take(20)".
I tried to return a new advancedCollection by creating a IEnumerable first with Take(20) but that doesn't look the right way because I need to keep it linked to the same ObservableCollection.