Skip to content
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

ItemsRepeater's child not found in its Children collection exception #9

Open
milkywayfarer opened this issue Oct 6, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@milkywayfarer
Copy link

Describe the bug
ItemsRepeater 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:

  1. Create a random UserControl with the size of 244x226 and margins 0 20 19 0 (a Panel with random background should work)
  2. Create a ViewModel that has an AvaloniaList<UserControl> to bind ItemsRepeater to
  3. In this ViewModel constructor, add 10 or more UserControl to the AvaloniaList
  4. Create a ScrollViewer with the size of 572x510, put ItemsRepeater with UniformGridLayout inside of it and bind it to the AvaloniaList
  5. 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):

  • OS: Windows 10 Pro 21H2
  • Version 0.10.7

Additional context
I saw the same problems with XML in microsoft/microsoft-ui-xaml#2969 and microsoft/microsoft-ui-xaml#2834. Maybe that could help.

@milkywayfarer milkywayfarer added the bug Something isn't working label Oct 6, 2021
@maxkatz6 maxkatz6 transferred this issue from AvaloniaUI/Avalonia Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant