/// <summary> /// Finds the WPF element where the DropTarget property has been defined. /// </summary> /// <param name="originalSource"> /// The original source where the Drop, /// or DragOver, operation is happening. /// </param> /// <returns> /// The element that holds the DropTarget, /// or null if none can be found. /// </returns> static DependencyObject FindDropTargetContainer(DependencyObject originalSource) { var element = originalSource.FindParent <DependencyObject>(t => { return(DragDropManager.GetDropTarget(t) != null); }); return(element); }
static Object FindDropTarget(DependencyObject originalSource) { var element = DragDropManager.FindDropTargetContainer(originalSource); if (element != null) { return(DragDropManager.GetDropTarget(element)); } return(null); }