microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

Proposal: Add incremental loading support for ItemsRepeater

Open DL444 opened this issue 6 years ago • 12 comments

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

  • Does incremental loading need to include support for both starting at the top and scrolling down (i.e. what ListView currently supports) as well as starting from the bottom and scrolling up (e.g. a chat view)?
  • Or starting in the middle and scrolling up or down (e.g. some kind of feed that needs to restore the scroll position of a list after navigating away and back)?
  • Is having the data source implement ISupportIncrementalLoading (or something equivalent that supports the above two scenarios) be preferred over explicitly listening to the viewport position and fetching new data?

DL444 avatar Mar 03 '19 09:03 DL444

@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?

micahl avatar Mar 21 '19 05:03 micahl

@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.

DL444 avatar Mar 21 '19 05:03 DL444

@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?

micahl avatar Mar 21 '19 20:03 micahl

@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:

  • Sounds more like a hack
  • Requires some extra work by developers
  • Is somewhat harder to implement using MVVM

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

DL444 avatar Mar 23 '19 15:03 DL444

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.

micahl avatar Mar 23 '19 18:03 micahl

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.

chrisahill avatar Oct 11 '19 18:10 chrisahill

@chrisahill CAN'T AGREE MORE.

HppZ avatar Nov 26 '21 12:11 HppZ

support incremental loading. @chingucoding

HppZ avatar Nov 26 '21 12:11 HppZ

@HppZ Nothing I can do...

marcelwgn avatar Dec 02 '21 19:12 marcelwgn

@HppZ Nothing I can do...

why or who can?

HppZ avatar Dec 03 '21 01:12 HppZ

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.

marcelwgn avatar Dec 03 '21 19:12 marcelwgn

I agree!!

BigHeadDev avatar Aug 27 '24 14:08 BigHeadDev