-
Notifications
You must be signed in to change notification settings - Fork 70
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
AdvancedCollection inserts element at wrong position when the element is added at the end of the source collection #317
Comments
Also submitted as: CommunityToolkit/WindowsCommunityToolkit#4965 |
Just run to this problem the other day. Had to use sorting, which decreases the performance a little bit. |
Thanks @abdes, I believe someone had tried to submit a fix for this before: CommunityToolkit/WindowsCommunityToolkit#4814 Related to #307 and the #309 PR. However, we really need proper tests here and to ensure we have the correct and desired behavior for various scenarios. So we need ones that show the issue, and also other similar edge cases, and that the submitted fix resolves the broken scenario without impacting the others. |
Describe the bug
In AdvancedCollection.cs,
When an item is added at the end of the source collection (i.e.
_source.Count -1
), the AdvancedCollection will insert it at the position_view.Count - 1
, which is the position just before the last item in the view. This is not correct and results in the items order not respecting the source collection order, if the view does not use sorting.Steps to reproduce
Expected behavior
The expected behavior is that the item is added at the end of the collection.
Screenshots
No response
Code Platform
Windows Build Number
Other Windows Build number
No response
App minimum and target SDK version
Other SDK version
No response
Visual Studio Version
No response
Visual Studio Build Number
No response
Device form factor
No response
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item.
The text was updated successfully, but these errors were encountered: