microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

WPF Gap: CollectionViewSource doesn't support all WPF scenarios #4307

Open michael-hawker opened 3 years ago

michael-hawker commented 3 years ago

Proposal: CollectionViewSource doesn't support all WPF scenarios

Summary

The CollectionViewSource in UWP is inferior to the one in WPF doc here.

The WPF one supports live filtering, grouping, and sorting all out of the box. The UWP one does not. ☹

For instance, this DataGrid grouping scenario is not easily achievable in UWP.

Rationale

Creating sorted, grouped, and/or filtered lists in UWP is a pain, especially trying to combine any combination of these. The CollectionViewSource is supposed to be this abstraction above the data layer itself. UWP/WinUI should provide a first/best-in-class solution to these common scenarios and match or improve upon the WPF APIs.

Scope

Capability Priority
Allow (Live) Grouping Must
Allow (Live) Sorting Must
Allow (Live) Filtering Must
Allow any combination of the three to work in tandum together Must
Able to configure CVS in XAML Should

Related to #2685 and #33

michael-hawker commented 3 years ago

We have the AdvancedCollectionView in the toolkit, but it doesn't support all the scenarios, and is already getting complex. It'd be great to just see this be within the platform and have the WPF version at least ported as a starting point.

omikhailov commented 3 years ago

In general, it would be good to have as flexible version of CollectionViewSource as WPF's one, but it seems like you are focusing on not the most demanded things. CollectionViewSource in WPF is intended for in-memory data processing. But today most common data source is IQueryable from WebAPI or Entity Framework and it is not common to load whole table in the application to sort / group / filter it on the client side. Sometimes instead of EF folk uses Dapper where IQueryable is not available, but this is another story and it does not work well with CollectionViewSource too. It would be much better if WinUI team would focus more on modern online use cases rather than compatibility.

LadderLogic commented 2 years ago

@michael-hawker is this feature on any projected road-maps ?

michael-hawker commented 2 years ago

@LadderLogic I own the Windows Community Toolkit, so I don't know if there's plans on the WinUI side to work on this in the near future or not. I don't think @anawishnoff is the correct owner for this anymore, @gabbybilka who should own this now?

We have an AdvancedCollectionView in the Toolkit, but it doesn't cover all the scenarios currently (thus why I opened this issue for tracking with the platform).

I'm not too sure where our gaps lie currently as we have some other helpers we've developed since for grouping scenarios. We want to improve our samples more later this year with our next release, so we'll have a better understanding then. I know @Sergio0694 has been making some examples of these scenarios for the MVVM Toolkit Samples, but not sure if they're merged into main yet or just in a PR.

LadderLogic commented 2 years ago

@LadderLogic I own the Windows Community Toolkit, so I don't know if there's plans on the WinUI side to work on this in the near future or not. I don't think @anawishnoff is the correct owner for this anymore, @gabbybilka who should own this now?

We have an AdvancedCollectionView in the Toolkit, but it doesn't cover all the scenarios currently (thus why I opened this issue for tracking with the platform).

I'm not too sure where our gaps lie currently as we have some other helpers we've developed since for grouping scenarios. We want to improve our samples more later this year with our next release, so we'll have a better understanding then. I know @Sergio0694 has been making some examples of these scenarios for the MVVM Toolkit Samples, but not sure if they're merged into main yet or just in a PR.

@michael-hawker Thank you! The AdvancedCollectionView works nicely for sort descriptors. Haven't found an example for grouping

kateryna-novak commented 1 year ago

@michael-hawker, @Sergio0694, could you please provide a sample of how to use grouping in the AdvancedCollectionView? As I understand from the documentation, AdvancedCollectionView supports grouping. However, I could not find any example of how to use it.

michael-hawker commented 1 year ago

@kateryna-novak if you just need grouping, there's the ObservableGroup option as well as shown in the MVVM Toolkit app Collection sample: https://aka.ms/mvvmtoolkit/app

kateryna-novak commented 1 year ago

@kateryna-novak if you just need grouping, there's the ObservableGroup option as well as shown in the MVVM Toolkit app Collection sample: https://aka.ms/mvvmtoolkit/app

@michael-hawker I need filtering and grouping. That's why I'm asking.

ttustonic commented 1 year ago

Is it even possible to have a multi level grouping in ListView, DataGrid etc? There's no example anywhere. Or is it also not 'modern online use case' ?