Describe the bug
Hello, this is my first issue here, I hope I dot it the right way.
With a AdvancedCollectionView used with a Filter and without SortDescription,
When a add a item to the source collection, the item is not inserted at the end of the CollectionView,
it inserted before the last item.
With no filter there is no problem
Steps to reproduce
ObservableCollection<int> sourceList = new ()
{
1,2,3,4,5
};
AdvancedCollectionView acv = new(sourceList, false);
//filter to keep only even integers
acv.Filter = x => (int)x % 2 == 0;
Assert.AreEqual("24", String.Join("", acv));
// succeed
sourceList.Add(6);
Assert.AreEqual("246", String.Join("", acv));
//failed result = 264
Expected behavior
The new item should be inserted at the end
Windows Build Number
Windows Community Toolkit version
7.1.0
Visual Studio Version
2022
Device form factor
Desktop
Additional context
If there is no filter the insertion index is defined like this, so in this case it work correctly :
|
var newViewIndex = _view.Count; |
I think the issue is from this line, in the HandleItemAdded method,
when there is a filter the new item index is define like this :
|
newViewIndex = _view.Count - 1; |
Help us help you
Yes, but only if others can assist.
Describe the bug
Hello, this is my first issue here, I hope I dot it the right way.
With a AdvancedCollectionView used with a Filter and without SortDescription,
When a add a item to the source collection, the item is not inserted at the end of the CollectionView,
it inserted before the last item.
With no filter there is no problem
Steps to reproduce
Expected behavior
The new item should be inserted at the end
Windows Build Number
Windows Community Toolkit version
7.1.0
Visual Studio Version
2022
Device form factor
Desktop
Additional context
If there is no filter the insertion index is defined like this, so in this case it work correctly :
WindowsCommunityToolkit/Microsoft.Toolkit.Uwp.UI/AdvancedCollectionView/AdvancedCollectionView.cs
Line 661 in b21dbe7
I think the issue is from this line, in the HandleItemAdded method,
when there is a filter the new item index is define like this :
WindowsCommunityToolkit/Microsoft.Toolkit.Uwp.UI/AdvancedCollectionView/AdvancedCollectionView.cs
Line 686 in b21dbe7
Help us help you
Yes, but only if others can assist.