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

Proposal: Add incremental loading support for ItemsRepeater #374

Open DL444 opened 5 years ago

DL444 commented 5 years ago

Proposal: Add incremental loading support for ItemsRepeater

Summary

Add incremental loading support for ItemsRepeater.

Rationale

Currently ItemsRepeater control does not support item sources implementing incremental loading (ISupportIncrementalLoading interface). Using such source results in no items being load.

However, right now using ItemsRepeater and creating custom VirtualizingLayout is the only way developers can create custom virtualizing ListView-like UI.

ListView and GridView support incremental loading only when using the two built-in VirtualizingPanel, and there is no way to create custom ones. That means developers must sacrifice either incremental loading or layout flexibility.

If ItemsRepeater control could support incremental loading, the problem would be solved.

Functional Requirements

Important Notes

Open Questions

micahl commented 5 years ago

@DL444, are there layout(s) you already have in mind with which you'd want to use incremental loading?

An alternative to ISupportIncrementalLoading on which I'd be interested to hear your feedback would be to observe the position of the ScrollViewer's viewport and load more data in your items source as the viewport approaches the extent. With ListView/GridView that would have been hard to do. They didn't make their internal ScrollViewer readily accessible. With ItemsRepeater having no control template you're forced to provide your own ScrollViewer. Depending on your perspective that may be good or bad, but it does make it easy to access and observe the viewport. Your thoughts?

DL444 commented 5 years ago

@micahl It was a custom virtualizing layout that I created, basically the same layout as the StaggeredPanel in Windows Community Toolkit. I also noticed there is a PinterestLayout in test code, the same as well. I've tried the alternative, and it works, I'm using it right now.

micahl commented 5 years ago

@DL444 Cool. Given your experience, which approach would you prefer to use? Should we keep this proposal open as-is or modify it to track updating the doc to explicitly call out this approach to incrementally load data?

DL444 commented 5 years ago

@micahl Well, I think it's okay to just update the document and close this for now, but I still want this implemented in the future, as the alternative solution:

But the alternative solution does work, and I understand that you might have priorities, so for now I think both is okay.

micahl commented 5 years ago

Good feedback! I'll add a note to the docs. Let's also keep this proposal open to discuss options and potential requirements for enabling support for incremental loading.

chrisahill commented 5 years ago

I've had to make a really custom implementation around ListView to get a grid of items with headers that supports virtualization, incremental loading, pull to refresh logic because ListView and GridView really didn't support the UI on UWP that our designer made for iOS and Android which had controls that could support what the designer created, which led me to have to figure out how to make that design work on UWP. The CollectionView could handle header and items, but doesn't implement the ISupportIncremental interface and CollectionView was sealed so I couldn't extend it, which led me down the road of hacking ListView to make it look like a GridView because GridView didn't work the way I needed it to. I then had to create my own CollectionView that supports ISupportIncrementalLoading The ItemRepeater sample we mocked out does everything that we needed, but didn't exist at the time we needed it, but the only thing that's missing to migrate to this control is support for incremental loading. Please add because I'd really like to migrate over to this control.

HppZ commented 2 years ago

@chrisahill CAN'T AGREE MORE.

HppZ commented 2 years ago

support incremental loading. @chingucoding

marcelwgn commented 2 years ago

@HppZ Nothing I can do...

HppZ commented 2 years ago

@HppZ Nothing I can do...

why or who can?

marcelwgn commented 2 years ago

First the proposal needs to be added to the backlog of things to be implemented, than there needs to be an API review (probably not gonna be a big one) and while that is happening it can be developed by someone.

BigHeadDev commented 2 months ago

I agree!!