New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grouped CollectionView lazy loading does not trigger [RemainingItemsThresholdReached] on iOS and Windows #10078
Comments
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
I consider this a serious problem. Since your [Image] component does not cache local files, it can take quite a long while to populate a CollectionView with images in its items. Lazy loading is the solution to this. Without a working lazy loading, it makes for a very frustrating user experience. Please reconsider this categorization. |
Please have a look at this - it is a show-stopper for Xamarin migration. @PureWeen, @jsuarezruiz |
@hbraasch @SophisticatedConsulting Try this temporary solution in Windows: <CollectionView Scrolled="CollectionView_Scrolled"/> private void CollectionView_Scrolled(object sender, ItemsViewScrolledEventArgs e)
{
//TODO WinUI 中,目前无法触发 RemainingItemsThresholdReachedCommand,因此先自己实现一下
if (DeviceInfo.Current.Platform != DevicePlatform.WinUI)
{
return;
}
if (sender is CollectionView cv && cv is IElementController element)
{
var count = element.LogicalChildren.Count;
if (e.LastVisibleItemIndex + 1 - count + cv.RemainingItemsThreshold >= 0)
{
if (cv.RemainingItemsThresholdReachedCommand.CanExecute(null))
{
cv.RemainingItemsThresholdReachedCommand.Execute(null);
}
}
}
} |
Thanks for the proposal @JiuLing-zhang. Unfortunately, this does not work with a Grouped CollectionView - the EventArgs passed references the current group in the CollectionView (all of which is always visible). In my case this is a group of 20 items displayed vertically and which should add additional groups when scrolled horizontally. e.LastVisibleItemIndex is always 20 and less than element.LogicalChildren.Count. It is not possible (as far as I can see) to find out when you have scrolled to the last group in the CollectionView and add the next. If I remove the check, then the scroll event is called far too often and the CollectionView is populated with too many groups. Any ideas? |
Verified this issue with Visual Studio 17.7.0 Preview 1.0. Can repro on windows and iOS platform with above project. Android works fine. |
In #13391 I posted a workaround that fixes the problem for me on iOS. |
Something worth mentioning, even with the workaround it only worked for me when RemainingItemsThreshold was different from 0. |
The issue also repro on Android platform. |
I am still experiencing this problem on iPad |
Our little bug is already 4 years old, he grows up so fast. It even learned to do its thing in .NET 8, I am so proud! Thanks for the updated workaround with handler @naaeef |
We faced this issue again while we were on dotNet 8, and I used the @JiuLing-zhang suggestion and solved my issue that on iOS it was not working for static threshold |
RemainingItemsThresholdReachedCommand doesn't trigger on Android either (net maui 8 latest). This is a show stopper. |
Description
When populating a CollectionView with grouped data, the [RemainingItemsThresholdReached] event does not trigger for iOS and Windows when the [RemainingItemsThreshold] value is reached.
This works fine under Android.
A simple repro is provided.
See here how Android works (must admit, it throws a low-level exception each time the threshold is reached, but maybe that is by design)
Android.mp4
See here how iOS only loads the first chunk, then never triggers when scrolled down.
iOS.mp4
See here how Windows loads the first chunk, then never triggers when scrolled down.
Windows.mp4
Steps to Reproduce
Link to public reproduction project repository
https://github.com/hbraasch/ChunkTester.git
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
iOS, Windows
Affected platform versions
Android 12 - API 31, windows10.0.19041.0
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: