The CollectionView class represents a view for grouping, sorting, filtering, and navigating data collections.
The object model used in the CollectionView class is similar to the one defined by .NET's ICollectionView and IPagedCollectionView interfaces.
To create data views, follow these steps:
- Create a new CollectionView.
- Set the sourceCollection to an array containing the raw data.
- Optionally add items to the sortDescriptions array to define how the data should be sorted.
- Optionally add items to the groupDescriptions array to define how the data should be grouped.
- Optionally set the filter property to a predicate function that selects the items that should be included in the view.
- Optionally set the pageSize property to define the number of items in the view, and use the moveToPage method to select the current page.
- Use the items array to get the output view.
- Use the currentItem property to get a reference to the item that is currently selected, and use the currentChanged event to detect selection changes.