[WPF] Using Linq to shape data in a CollectionView
WPF provides a simple mechanism for shaping collections of data, via the ICollectionView interface and its Filter, SortDescriptions and GroupDescriptions properties:
// Collection to which the view is bound public ObservableCollection People { get; private set; } ... // Default view of the People collection ICollectionView view = CollectionViewSource.GetDefaultView(People); // Show only adults view.Filter = o => ((Person)o).Age >= 18; // Sort by last name and first name view.SortDescriptions.Add(new SortDescription("LastName", ListSortDirection.