From eb7aebd17d5fb6c507dd755b76a959316fab85a8 Mon Sep 17 00:00:00 2001 From: Kevin Nolan Date: Mon, 24 Feb 2025 17:52:10 -0500 Subject: [PATCH 1/2] Fixed issue with IncrementalLoadingCollection within AdvancedCollectionView --- .../AdvancedCollectionView/AdvancedCollectionView.cs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs b/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs index 416d87f8..6f7ef177 100644 --- a/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs +++ b/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs @@ -386,16 +386,7 @@ int IComparer.Compare(object x, object y) if (!_sortProperties.Any()) { var listType = _source?.GetType(); - Type type; - - if (listType != null && listType.IsGenericType) - { - type = listType.GetGenericArguments()[0]; - } - else - { - type = x.GetType(); - } + Type type = x.GetType(); foreach (var sd in _sortDescriptions) { From c6f687a9e87e3dd50000bd33cc71423eb40cf687 Mon Sep 17 00:00:00 2001 From: Kevin Nolan Date: Thu, 27 Feb 2025 16:38:50 -0500 Subject: [PATCH 2/2] Instead of using first object type, added if clause to detect IncrementalLoadingCollection. --- .../AdvancedCollectionView.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs b/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs index 6f7ef177..7240ea24 100644 --- a/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs +++ b/components/Collections/src/AdvancedCollectionView/AdvancedCollectionView.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using CommunityToolkit.WinUI.Helpers; +using System; +using System.CodeDom; using System.Collections; using System.Collections.Specialized; using System.Runtime.CompilerServices; @@ -386,7 +388,20 @@ int IComparer.Compare(object x, object y) if (!_sortProperties.Any()) { var listType = _source?.GetType(); - Type type = x.GetType(); + Type type; + + if (listType == typeof(IncrementalLoadingCollection)) + { + type = listType.GetGenericArguments()[1]; + } + else if (listType != null && listType.IsGenericType) + { + type = listType.GetGenericArguments()[0]; + } + else + { + type = x.GetType(); + } foreach (var sd in _sortDescriptions) {