Exemplo n.º 1
0
        /// <summary>
        /// Finds the WPF element where the drop command is attached.
        /// </summary>
        /// <param name="originalSource">
        /// The original source where the Drop,
        /// or DragOver, operation is happening.
        /// </param>
        /// <returns>
        /// The element that holds the drop command,
        /// or null if none can be found.
        /// </returns>
        static DependencyObject FindDropCommandHolder(DependencyObject originalSource)
        {
            var element = originalSource.FindParent <DependencyObject>(t =>
            {
                return(DragDropManager.GetOnDropCommand(t) != null);
            });

            return(element);
        }
Exemplo n.º 2
0
        static ICommand FindDropCommand(DependencyObject originalSource)
        {
            var element = DragDropManager.FindDropCommandHolder(originalSource);

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

            return(null);
        }