Skip to content

Items repeater with UniformGridLayout doesn't recycle item zero in a consistent manner compared to other items #30

@philvanzu

Description

@philvanzu

Describe the bug

derived ItemsRepeater, used in conjunction with a UniformGridLayout, subcribed to ItemPrepared / ItemClearing events and calling back the relevant element's datacontext viewmodel to allow for thumbnail loading / unloading when the element is prepared / cleared... The issue is just with item zero in the ItemSource. I'm not sure if it's the element not being recycled properly or if its datacontext property is not setup correctly at the time of these events, but it appears item zero immediately prepares again after being cleared, and clears again after being prepared.

To Reproduce

I made a demonstration project here : https://github.com/philvanzu/VirtualizingItemsRepeaterBugDemo.git. Build it, run it, scroll down until you see a log of item zero being recycled, then scroll back up to the top and you should see item zero not being loaded as it should be. Built and tested on Linux (CachyOs) with JetBrains Rider and Avalonia 11.3.

Expected behavior

Item zero should be loaded correctly after scrolling down until it recycled, then scrolled back up until it is re-prepared

Avalonia version

11.3.1

OS

Linux

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions