microsoft / WinUI-Gallery

This app demonstrates the controls available in WinUI and the Fluent Design System.
MIT License
2.84k stars 636 forks source link

How to do all the things to a Collection - Sorting, Filtering, Updating, Grouping #1625

Open michael-hawker opened 2 months ago

michael-hawker commented 2 months ago

Issue type

sample request

Which version of the app?

WinUI 3 Gallery

Description

Especially for the new ItemsView, but even just for ListView, there's not a full-fledged example anywhere of how to take a large collection of items and performantly sort, filter, update, and group them within a UI container.

In WPF, CollectionViewSource did a lot of heavy lifting here, but there's a gap for the platform still on this: https://github.com/microsoft/microsoft-ui-xaml/issues/4307

So, even more so, a sample that shows how to do this that's production ready would be appreciated.

The doc on filtering that do exist, seems woefully inefficient or error-prone compared to the simplicity of setting the Filter from WPF days: https://learn.microsoft.com/dotnet/desktop/wpf/data/how-to-filter-data-in-a-view

Screenshots

No response

Windows version

No response

Additional context

No response

AndrewKeepCoding commented 1 month ago

This demo app might help. 🙂

https://github.com/user-attachments/assets/5f796f6b-0a9d-4357-bb3f-22a39ed2363b

AndrewKeepCoding commented 1 month ago

Here's the repo.

https://github.com/AndrewKeepCoding/CollectionOperationsDemo

AndrewKeepCoding commented 1 month ago

I'm not sure if the ItemsView is a good option for grouping. The selection feature is not what you would expect. 🤔