Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        static Object FindDropTarget(DependencyObject originalSource)
        {
            var element = DragDropManager.FindDropTargetContainer(originalSource);

            if (element != null)
            {
                return(DragDropManager.GetDropTarget(element));
            }

            return(null);
        }