Skip to content

Commit

Permalink
chore: Adjust typing
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Oct 23, 2024
1 parent f4fe4f0 commit ca94c04
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/Uno.UI/UI/Xaml/Data/CollectionView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using Uno;
using Uno.Extensions;
using Uno.Extensions.Specialized;
Expand Down Expand Up @@ -250,9 +249,24 @@ void ICollection<object>.CopyTo(object[] array, int arrayIndex)
_collection?.ToObjectArray().CopyTo(array, arrayIndex);
}

IEnumerator<object> IEnumerable<object>.GetEnumerator() => GetEnumerator();
IEnumerator<object> IEnumerable<object>.GetEnumerator()
{
var enumerator = (this as IEnumerable).GetEnumerator();
while (enumerator.MoveNext())
{
yield return enumerator.Current;
}
}

IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
IEnumerator IEnumerable.GetEnumerator()
{
// In Windows if CollectionView is from a CollectionViewSource marked grouped, it enumerates the flattened list of objects
if (_isGrouped)
{
return CollectionGroups.OfType<ICollectionViewGroup>().SelectManyUntyped(c => c.GroupItems).GetEnumerator();
}
return (_collection as IEnumerable).GetEnumerator();
}

public IEnumerator<object> GetEnumerator()
{
Expand Down

0 comments on commit ca94c04

Please sign in to comment.