Describe the bugItemsRepeater using UniformGridLayout with 9 or more children gives the exception when you scroll it back and forth. It seems like ItemsRepeater does not load all the binded items together and unloads items that are unreachable by the user which might cause this kind of problems. It unloads the first item in my collection when I scroll to the bottom (you can see it in Avalonia DevTools) and does not load it back, leaving just blank space and crashing after I attempt to scroll again.
To Reproduce
Steps to reproduce the behavior:
Create a random UserControl with the size of 244x226 and margins 0 20 19 0 (a Panel with random background should work)
Create a ViewModel that has an AvaloniaList<UserControl> to bind ItemsRepeater to
In this ViewModel constructor, add 10 or more UserControl to the AvaloniaList
Create a ScrollViewer with the size of 572x510, put ItemsRepeater with UniformGridLayout inside of it and bind it to the AvaloniaList
Run and scroll to the bottom and back - the first element should disappear, and scrolling back to the bottom crashes the app with System.InvalidOperationException: 'ItemsRepeater's child not found in its Children collection.'
Expected behavior
Scrolling should not make the 0th item in the collection disappear and crash the app.
Desktop (please complete the following information):
Describe the bug
ItemsRepeater
usingUniformGridLayout
with 9 or more children gives the exception when you scroll it back and forth. It seems likeItemsRepeater
does not load all the binded items together and unloads items that are unreachable by the user which might cause this kind of problems. It unloads the first item in my collection when I scroll to the bottom (you can see it in Avalonia DevTools) and does not load it back, leaving just blank space and crashing after I attempt to scroll again.To Reproduce Steps to reproduce the behavior:
UserControl
with the size of 244x226 and margins 0 20 19 0 (aPanel
with random background should work)ViewModel
that has anAvaloniaList<UserControl>
to bindItemsRepeater
toViewModel
constructor, add 10 or moreUserControl
to theAvaloniaList
ScrollViewer
with the size of 572x510, putItemsRepeater
withUniformGridLayout
inside of it and bind it to theAvaloniaList
System.InvalidOperationException: 'ItemsRepeater's child not found in its Children collection.'
Expected behavior Scrolling should not make the 0th item in the collection disappear and crash the app.
Desktop (please complete the following information):
Additional context I saw the same problems with XML in https://github.com/microsoft/microsoft-ui-xaml/pull/2969 and https://github.com/microsoft/microsoft-ui-xaml/issues/2834. Maybe that could help.