Skip to content

Incremental loading seems to stop at 40650 items #415

Description

@catmanjan

I tried the new incremental loading example, I removed the limit from my ItemSource and I noticed that it reached 40650 and stopped

using Microsoft.UI.Xaml.Data;
using System;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;

namespace OpenTable
{
    public partial class TableSource : ObservableCollection<Row>, ISupportIncrementalLoading
    {
        private const uint PageSize = 50;

        public event EventHandler<bool>? LoadingStateChanged;

        int acount = 0;

        public bool HasMoreItems => true;

        public IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count)
        {
            return AsyncInfo.Run(async cancellationToken =>
            {
                LoadingStateChanged?.Invoke(this, true);

                try
                {
                    for (var i = 0; i < PageSize; i++)
                    {
                        acount++;
                        Add(new Row() { A = "" + acount });
                    }

                    return new LoadMoreItemsResult { Count = PageSize };
                }
                finally
                {
                    LoadingStateChanged?.Invoke(this, false);
                }
            });
        }
    }
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions