Skip to content

Commit

Permalink
Added fallback to support legacy drop target adorners
Browse files Browse the repository at this point in the history
  • Loading branch information
jizc committed Dec 5, 2024
1 parent c8f2d43 commit 57c9116
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/GongSolutions.WPF.DragDrop/DropTargetAdorner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ internal static DropTargetAdorner Create(Type type, UIElement adornedElement, ID
throw new InvalidOperationException("The requested adorner class does not derive from DropTargetAdorner.");
}

return type.GetConstructor(new[] { typeof(UIElement), typeof(IDropInfo) })?.Invoke(new object[] { adornedElement, dropInfo }) as DropTargetAdorner;
var ctor = type.GetConstructor(new[] { typeof(UIElement), typeof(IDropInfo) });
if (ctor is null && dropInfo is DropInfo)
{
ctor = type.GetConstructor(new[] { typeof(UIElement), typeof(DropInfo) });
}

return ctor?.Invoke(new object[] { adornedElement, dropInfo }) as DropTargetAdorner;
}
}
}

0 comments on commit 57c9116

Please sign in to comment.