コード例 #1
0
 private void treeView_MouseMove(object sender, MouseEventArgs e)
 {
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         if (DropAdapter == null)
         {
             return;
         }
         if (!(e.Source is BaseTreeView))
         {
             return;
         }
         if (treeView.SelectedItem == null)
         {
             return;
         }
         TreeNavigationItem selectedTreeNavigationItem = treeView.SelectedItem as TreeNavigationItem;
         if (!DropAdapter.DragStart(e, selectedTreeNavigationItem))
         {
             return;
         }
         TreeViewItem treeViewItem = GetTreeViewItemAt(e.GetPosition(treeView));
         //_dragAdorner = new DragAdorner(treeViewItem, treeViewItem.DesiredSize, e.GetPosition(treeView));
         DragDrop.DoDragDrop(treeView, treeView.SelectedItem, DragDropEffects.All);
         //_dragAdorner.Detach();
     }
 }
コード例 #2
0
        private void treeView_Drop(object sender, DragEventArgs e)
        {
            if (DropAdapter == null)
            {
                return;
            }
            TreeNavigationItem targetTreeNavigationItem  = GetTreeNavigationItemAt(e.GetPosition(treeView));
            TreeNavigationItem draggedTreeNavigationItem = GetDataFromDragEventArgs(e);

            DropAdapter.Drop(e, draggedTreeNavigationItem, targetTreeNavigationItem);
        }
コード例 #3
0
        private void treeView_DragOver(object sender, DragEventArgs e)
        {
            if (DropAdapter == null)
            {
                return;
            }
            TreeNavigationItem targetTreeNavigationItem  = GetTreeNavigationItemAt(e.GetPosition(treeView));
            TreeNavigationItem draggedTreeNavigationItem = GetDataFromDragEventArgs(e);

            //      _dragAdorner.UpdatePosition(e.GetPosition(treeView));
            DropAdapter.DragOver(e, draggedTreeNavigationItem, targetTreeNavigationItem);
            e.Handled = true;
        }