microsoft-ui-xaml: ItemsRepeater breaks when scrolling through variable height items

Describe the bug

With a long list of elements of different heights in an ItemsRepeater, scrolling breaks, often showing a blank page.

Steps to reproduce the bug

Edit BasicDemo to contain the following:

        <controls:ItemsRepeaterScrollHost x:Name="tracker" Grid.Row="1">
            <ScrollViewer x:Name="scrollViewer">
                <controls:ItemsRepeater x:Name="repeater" VerticalCacheLength="0" Background="LightBlue">
                    <controls:ItemsRepeater.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Text}" Height="{Binding Height}"/>
                        </DataTemplate>
                    </controls:ItemsRepeater.ItemTemplate>
                </controls:ItemsRepeater>
            </ScrollViewer>
        </controls:ItemsRepeaterScrollHost>
    public sealed partial class BasicDemo : Page
    {
        public BasicDemo()
        {
            this.InitializeComponent();

            var random = new Random(0);
            repeater.ItemsSource = Enumerable.Range(0, 10000).Select(x => new BasicItem {
                Text = "Item " + x,
                Height = random.Next(240) + 10
            });
        }
    }

    public class BasicItem
    {
        public string Text { get; set; }
        public int Height { get; set; }
    }

Run the TestApp and use scrollbar to scroll through the list of items.

Expected behavior

Items are displayed at all positions of the scrollbar.

Screenshots

uTxNTHiVJo

Version Info

Current master (8f497521)

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2019 Update (18362) Yes
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Mobile
Xbox
Surface Hub
IoT

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 11
  • Comments: 20 (10 by maintainers)

Most upvoted comments

Yeah that’s unavoidable I think. Scroll anchoring fixes it for scrolling small increments, but for big increments #435 would be required to prevent the thumb jumping.

In the meantime though, not displaying a blank list would be an improvement.

This seems to happen only when using mouse thumb drag and when having a large number of elements (>~5000). Works fine for touch. It also fixes itself if you scroll by a little bit after. That suggests that this might be a bug in the disconnected jump logic in stack layout when the extent is particularly large (does not repro for say 1000 items). It is likely the size of the extent that causes it as opposed to the number of items.