AdvancedCollectionView: sorting behavior is not correct
Describe the bug
class Video
{
public int id;
public (int, uint, int, int, int, uint) SortValue { get; set; }
}
ObservableCollection<Video> _screenCollection = new();
AdvancedCollectionView AdvancedCollectionView = new AdvancedCollectionView(_screenCollection);
AdvancedCollectionView.SortDescriptions.Add(new SortDescription("SortValue", SortDirection.Ascending));
for(int i=1; i< 25; i++)
_screenCollection.Add(new Video { SortValue = (1, 5, 0, 0, 0, 0), id=i });
//Order is 3,5,7...
AdvancedCollectionView.RefreshSorting();
//Order is 3,4,6
AdvancedCollectionView.RefreshSorting();
//Order is 3,5,7
- SortValue is same, so I expect the order is same with original collection -> 1,2,3,4,...
- Why each time calling RefreshSorting(), the order is different. So in UI, if one field of Video change and call RefreshSorting, instead of just change that video's order, It changes a lot of other videos.
Regression
No response
Reproducible in sample app?
- [ ] This bug can be reproduced in the sample app.
Steps to reproduce
Run above code
Expected behavior
Sorting should sort which has value changed.
Screenshots
No response
Windows Build Number
- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [ ] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)
Other Windows Build number
No response
App minimum and target SDK version
- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)
Other SDK version
No response
Visual Studio Version
No response
Visual Studio Build Number
No response
Device form factor
No response
Nuget packages
No response
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item.
Hello khoabui1412, thank you for opening an issue with us!
I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌
This issue has been marked as "needs attention 👋" due to no activity for 15 days. Please triage the issue so the fix can be established.
Hi @khoabui1412 I've moved this to the new repo with the latest code. I believe there's an open PR, but not sure if it addresses this issue. Have you tried this on the latest code/package for this helper or only on the 7.1.x line?
Not sure which version is latest code/package, but I test on latest CommunityToolKit which is 7.1.2