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 Becomes Desynchronized With Items After Item Sort #13

Open
skuehlshelby opened this issue Sep 16, 2022 · 3 comments
Open
Labels
bug Something isn't working

Comments

@skuehlshelby
Copy link

Description
When using an ItemsRepeater control, the displayed items become out of sync with the items source after the items source is sorted. Display order is not respected, and other weird things can happen as well, including repeated visual elements which are not duplicated in the items source.

To Reproduce
The problem has persisted for me under a variety of circumstances. I have tried the following to fix the problem:

  • Scenario 1: When using ObservableCollection, I sort the items source using only the Move() method.

  • Scenario 2: When using ObservableCollection, I sort the items source in a temporary copy, then Clear() the items source and Add() from the sorted copy.

  • Scenario 3: When using a OneWay binding from the items source to ItemsRepeater.Items, I sort the items source in a temporary copy, destroy the original, assign the sorted copy to the items source, and then raise a PropertyChanged event.

  • CURRENT WORKAROUND: When a sort is completed, I destroy the previous ItemsRepeater and create a new one with the sorted items.

Expected behavior
The displayed items should match the source items, in both number and order, at all times.

Desktop

  • OS: Windows 10 Enterprise
  • Version: 10.0.19043 Build 19043

Additional context
This is my first project with Avalonia, so please tell me if you think I am doing something incorrectly.

@skuehlshelby skuehlshelby added the bug Something isn't working label Sep 16, 2022
@maxkatz6
Copy link
Member

I have using sorting with no issues before. So minimal repro would be helpful.

Do you maybe use WrapLayout? This one is known to has such issue. #6

@skuehlshelby
Copy link
Author

I am not using WrapLayout. I will try go get a minimal repro, but I might not have time.

@timunie
Copy link

timunie commented Sep 16, 2022

I am not using WrapLayout. I will try go get a minimal repro, but I might not have time.

It's up to you. But without a sample, no help can be provided. I hope for your understanding.

@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

3 participants