Code example:
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, instead of just change that video's order, It changes a lot of other videos.