Open hahagu opened 1 year ago
version means Avalonia version, not OS version. Can you please add this? thx.
version means Avalonia version, not OS version. Can you please add this? thx.
Hey, thanks for getting back.
I've fixed the version number.
Sorry for the confusion!
ItemsRepeater
uses virtualization. As you scroll items out of view, their containers will be used for items that are about to be shown, thus their Datacontext is set to the new items. The datacontext of each real item in the Source is still preserved, but its position in the Logical tree is not representative of it's visual location.
Describe the bug Using the
ItemsRepeater
insideScrollViewer
causes inconsistencies withDataContext
. When I scroll to the end of theScrollViewer
, or close to, the first few items'DataContext
becomes null, and when going back up, it may get mixed around with other objects.To Reproduce
Steps to reproduce the behavior:
ItemsRepeater
control insideScrollViewer
and populateItemsRepeater
ScrollViewer
far enoughDataContext
ofItemsRepeater
Expected behavior
DataContext
is supposed to not become null, or get jumbled around.Screenshots
https://github.com/AvaloniaUI/Avalonia/assets/3746349/1fd285e2-c529-4ede-b68f-cc01b1cd32a1
Desktop (please complete the following information):
Additional context
Bug case minimal reproducible example bug_case.zip