예제 #1
0
        public virtual void ProcessMouseMove(MouseEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

#if DEBUG
            this.CheckMouseEventArgs(e);
#endif

            if ((this.InitialMousePositionToDragContainerAdorner.HasValue) &&
                (e.LeftButton == MouseButtonState.Pressed))
            {
                if (!this.IsDragging)
                {
                    Point currentPosition = e.GetPosition(this.AdornerLayerInsideDragContainer);

                    if (DragDropHelper.IsMouseMoveDrag(this.InitialMousePositionToDraggedElement.Value, currentPosition))
                    {
                        this.BeginDrag();
                    }
                }

                if (this.IsDragging)
                {
                    this.Drag(e);
                }
            }
        }
        private void DragMove(Func <IInputElement, Point> getPosition, bool isCreatingCopy)
        {
            if (!m_initialMousePositionToAdorner.HasValue)
            {
                return;
            }

            if (!m_isDragging)
            {
                var position = getPosition.Invoke(m_adornerLayer);

                if (DragDropHelper.IsMouseMoveDrag(m_initialMousePositionToAdorner.Value, position))
                {
                    m_draggedElementGhost = DragSourceManagerBase.CreateDraggedElementGhost(m_draggedElement, isCreatingCopy);

                    this.OnDragStart(getPosition);
                    this.IsDragging = true;
                }
            }

            if (m_isDragging)
            {
                this.OnDragMove(getPosition);
                this.UpdateGhost(getPosition);
            }
        }
예제 #3
0
 internal static IEnumerable <DropTargetInfo> GetDropTargetAtPoint(
     UIElement draggedElement,
     UIElement container,
     MouseEventArgs e)
 {
     return(DragDropHelper.GetDropTargetAtPoint(draggedElement, container, e.GetPosition));
 }
예제 #4
0
        protected virtual IDropTarget GetDropTargetOnDrag(MouseEventArgs e, out Nullable <Point> dropTargetPosition, out IDropTarget lastFoundDropTarget)
        {
            IDropTarget dropTarget = DragDropHelper.GetDropTargetAtPoint(this.DraggedElement, this.DragContainer, e, out dropTargetPosition, out lastFoundDropTarget);

            // ColumnManagerRow was defined as IDropTarget only because Animated Column Reordering required it, ignore it in base class
            if (dropTarget is ColumnManagerRow)
            {
                dropTarget         = null;
                dropTargetPosition = null;
            }

            return(dropTarget);
        }
        protected virtual DropTargetInfo GetDropTarget(Func <IInputElement, Point> getPosition)
        {
            foreach (var info in DragDropHelper.GetDropTargetAtPoint(this.DraggedElement, this.Container, getPosition))
            {
                if (!info.CanDrop)
                {
                    continue;
                }

                // ColumnManagerRow was defined as IDropTarget only because Animated Column Reordering required it, ignore it in base class
                if (info.Target is ColumnManagerRow)
                {
                    break;
                }

                return(info);
            }

            return(new DropTargetInfo(null, null, false));
        }