Пример #1
0
        public void HandleDragOver(object sender, DragEventArgs e, BaseTreeViewItem treeViewItem)
        {
            Assert.ArgumentNotNull(sender, nameof(sender));
            Assert.ArgumentNotNull(e, nameof(e));
            Assert.ArgumentNotNull(treeViewItem, nameof(treeViewItem));

            adorner.AllowedPositions = ControlDragAdornerPosition.None;

            if (e.Data.GetDataPresent(LayoutDesigner.DragIdentifier))
            {
                adorner.AllowedPositions = ControlDragAdornerPosition.Top | ControlDragAdornerPosition.Bottom;
                var h = adorner.GetHitTest(e);
                e.Effects = (h & adorner.AllowedPositions) != ControlDragAdornerPosition.None ? DragDropEffects.Move : DragDropEffects.None;

                /*
                 * if (e.Effects == DragDropEffects.Move && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
                 * {
                 * e.Effects = DragDropEffects.Copy;
                 * }
                 */
            }
            else if (e.Data.GetDataPresent(DragManager.DragIdentifier))
            {
                adorner.AllowedPositions = ControlDragAdornerPosition.Top | ControlDragAdornerPosition.Bottom;
                var h = adorner.GetHitTest(e);
                e.Effects = (h & adorner.AllowedPositions) != ControlDragAdornerPosition.None ? DragDropEffects.Copy : DragDropEffects.None;
            }
            else if (e.Data.GetDataPresent(BindingAnchor.BindingAnchorDragIdentifier))
            {
                var anchor = (BindingAnchor)e.Data.GetData(BindingAnchor.BindingAnchorDragIdentifier);
                anchor.HandleDragOver(this, e);
            }
        }
Пример #2
0
        public void HandleDragOver(object sender, DragEventArgs e, BaseTreeViewItem treeViewItem)
        {
            Assert.ArgumentNotNull(sender, nameof(sender));
            Assert.ArgumentNotNull(e, nameof(e));
            Assert.ArgumentNotNull(treeViewItem, nameof(treeViewItem));

            adorner.AllowedPositions = ControlDragAdornerPosition.None;

            if (e.Data.GetDataPresent(DragIdentifier))
            {
                e.Effects = DragDropEffects.Move;
                adorner.AllowedPositions = ControlDragAdornerPosition.Top | ControlDragAdornerPosition.Bottom;
            }

            if (!e.Data.GetDataPresent(DragManager.DragIdentifier))
            {
                return;
            }

            adorner.AllowedPositions = ControlDragAdornerPosition.Top | ControlDragAdornerPosition.Bottom;
            var h = adorner.GetHitTest(e);

            e.Effects = (h & adorner.AllowedPositions) != ControlDragAdornerPosition.None ? DragDropEffects.Move : DragDropEffects.None;
        }