Skip to content

TableView becomes unresponsive after ItemsSource (ISupportIncrementalLoading) count reaches zero #419

Description

@Verchinderlichtzer

Description
TableView becomes permanently unresponsive (no visual updates on Add/Delete/Import/Export, even though the underlying data source is correctly updated) once the bound ItemsSource (implementing ISupportIncrementalLoading) transitions to a count of zero. This happens whether the collection starts empty, or is emptied via deletion. Restarting the app is the only way to recover.

Steps to Reproduce

  1. Bind TableView.ItemsSource to a custom collection implementing ISupportIncrementalLoading (see minimal repro below).
  2. Start with an empty collection (Count == 0) OR delete items one by one until Count reaches 0.
  3. Add a new item to the underlying source, then refresh (Clear() + re-populate the same instance, or assign a fresh ItemsSource).
  4. Observe: TableView UI does not update — no new rows appear, no visual refresh — even though the source collection itself is correctly populated (confirmed via debugger / exported file).
  5. Restart the application: previously "invisible" items now render correctly.

Expected behavior
TableView should keep responding to ItemsSource/CollectionChanged updates normally after the bound collection's count returns to zero and then increases again.

Actual behavior
TableView silently stops updating its visual rows the moment the source count hits zero, and never recovers within the same app session.

Minimal repro collection

public class MyIncrementalCollection : ObservableCollection<MyItem>, ISupportIncrementalLoading
{
    private List<MyItem> _source;
    private int _chunkSize;
    private int _currentIndex;

    public MyIncrementalCollection(List<MyItem> source, int chunkSize = 25)
    {
        _source = source;
        _chunkSize = chunkSize;
    }

    public bool HasMoreItems => _currentIndex < _source.Count;

    public void Reset(List<MyItem> source)
    {
        _source = source;
        _currentIndex = 0;
        Clear();
    }

    public IAsyncOperation<LoadMoreItemsResult> LoadMoreItemsAsync(uint count)
    {
        return AsyncInfo.Run(async cancellationToken =>
        {
            int itemsToFetch = Math.Min(_chunkSize, _source.Count - _currentIndex);
            var nextChunk = _source.Skip(_currentIndex).Take(itemsToFetch).ToList();
            await Task.Delay(50, cancellationToken);
            foreach (var item in nextChunk) Add(item);
            _currentIndex += itemsToFetch;
            return new LoadMoreItemsResult { Count = (uint)itemsToFetch };
        });
    }
}

Environment

  • WinUI.TableView version: 1.4.1
  • Target framework: net10.0-windows10.0.19041.0
  • TargetPlatformMinVersion: 10.0.19041.0
  • Windows App SDK: 2.3.1
  • OS: Windows 11 (26200.8973)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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