Skip to content

Commit

Permalink
Use generic arguments if possible to get type of elements in lists
Browse files Browse the repository at this point in the history
  • Loading branch information
lhak committed Jun 6, 2023
1 parent a8bee9b commit dc47516
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion components/AdvancedCollectionView/src/AdvancedCollectionView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,18 @@ int IComparer<object>.Compare(object x, object y)
{
if (!_sortProperties.Any())
{
var type = x.GetType();
var listType = _source?.GetType();
Type type;

if (listType != null && listType.IsGenericType)
{
type = listType.GetGenericArguments()[0];
}
else
{
type = x.GetType();
}

foreach (var sd in _sortDescriptions)
{
if (!string.IsNullOrEmpty(sd.PropertyName))
Expand Down

0 comments on commit dc47516

Please sign in to comment.