Skip to content

Commit

Permalink
Merge pull request #338 from dauthleikr/dev
Browse files Browse the repository at this point in the history
Fix DefaultDropHandler.TestCompatibleTypes for any IEditableCollectionView
  • Loading branch information
punker76 authored Dec 4, 2019
2 parents 0ba5f5d + 5367d20 commit a0f31d1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/GongSolutions.WPF.DragDrop/DefaultDropHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@ protected static bool IsChildOf(UIElement targetItem, UIElement sourceItem)

protected static bool TestCompatibleTypes(IEnumerable target, object data)
{
TypeFilter filter = (t, o) => { return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>)); };
bool InterfaceFilter(Type t, object o) => (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(IEnumerable<>));

var enumerableInterfaces = target.GetType().FindInterfaces(filter, null);
var enumerableInterfaces = target.GetType().FindInterfaces(InterfaceFilter, null);
var enumerableTypes = from i in enumerableInterfaces
select i.GetGenericArguments().Single();

if (enumerableTypes.Count() > 0)
if (enumerableTypes.Any())
{
var dataType = TypeUtilities.GetCommonBaseClass(ExtractData(data));
return enumerableTypes.Any(t => t.IsAssignableFrom(dataType));
}
else
{
return target is IList;
return target is IList || target is ICollectionView;
}
}
}
Expand Down

0 comments on commit a0f31d1

Please sign in to comment.