Esempio n. 1
0
 void IDropTarget.DragOver(IDropInfo dropInfo)
 {
     if (DefaultDropHandler.CanAcceptData(dropInfo))
     {
         var isTreeViewItem          = dropInfo.InsertPosition.HasFlag(RelativeInsertPosition.TargetItemCenter) && dropInfo.VisualTargetItem is TreeViewItem;
         RemoteTreeViewItem srcItem  = dropInfo.Data as RemoteTreeViewItem;
         RemoteTreeViewItem destItem = dropInfo.TargetItem as RemoteTreeViewItem;
         if (destItem != null)
         {
             if (destItem.RemoteType != RemoteType.dir && destItem.Parent == srcItem.Parent)
             {
                 return;
             }
             if (destItem == srcItem.Parent)
             {
                 return;
             }
         }
         else
         {
             if (srcItem.Parent is RemoteTreeViewItem == false)
             {
                 return;
             }
         }
         dropInfo.Effects = DefaultDropHandler.ShouldCopyData(dropInfo) ? DragDropEffects.Copy : DragDropEffects.Move;
         if (isTreeViewItem)
         {
             dropInfo.DropTargetAdorner = typeof(RemooeTreeHighlightAdorner);
         }
     }
 }
Esempio n. 2
0
 public void DragOver(IDropInfo dropInfo)
 {
     if (DefaultDropHandler.CanAcceptData(dropInfo))
     {
         // default should always the move action/effect
         var copyData = (dropInfo.DragInfo.DragDropCopyKeyState != default(DragDropKeyStates)) && dropInfo.KeyStates.HasFlag(dropInfo.DragInfo.DragDropCopyKeyState)
                        //&& (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget)
                        && !(dropInfo.DragInfo.SourceItem is HeaderedContentControl) &&
                        !(dropInfo.DragInfo.SourceItem is HeaderedItemsControl) &&
                        !(dropInfo.DragInfo.SourceItem is ListBoxItem);
         dropInfo.Effects = copyData ? DragDropEffects.Copy : DragDropEffects.Move;
         var isTreeViewItem = dropInfo.InsertPosition.HasFlag(RelativeInsertPosition.TargetItemCenter) && dropInfo.VisualTargetItem is TreeViewItem;
         dropInfo.DropTargetAdorner = isTreeViewItem ? DropTargetAdorners.Highlight : DropTargetAdorners.Insert;
     }
 }
        public static void DragOver(IDropInfo dropInfo)
        {
            if (dropInfo.DragInfo == null)
            {
                if (dropInfo.Data is DataObject data && data.ContainsFileDropList())
                {
                    dropInfo.Effects = DragDropEffects.Copy;
                }
            }
            else if (DefaultDropHandler.CanAcceptData(dropInfo))
            {
                dropInfo.Effects = DragDropEffects.Move;
            }

            if (dropInfo.Effects != DragDropEffects.None)
            {
                dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
            }
        }