Example #1
0
        protected virtual void OnPreviewDragOver(RadDragOverEventArgs e)
        {
            EventHandler <RadDragOverEventArgs> eh = this.Events[PreviewDragOverEventKey] as EventHandler <RadDragOverEventArgs>;

            if (eh != null)
            {
                eh(this, e);
            }
        }
Example #2
0
        protected virtual void OnPreviewDragOver(RadDragOverEventArgs e)
        {
            EventHandler <RadDragOverEventArgs> eventHandler = this.Events[RadDragDropService.PreviewDragOverEventKey] as EventHandler <RadDragOverEventArgs>;

            if (eventHandler == null)
            {
                return;
            }
            eventHandler((object)this, e);
        }
Example #3
0
        private void DoDrag(Point mousePt)
        {
            RadItem draggedElement = this.Context as RadItem;

            this.SetHintWindowPosition(mousePt);

            Point        oldDropLocation = this.dropLocation;
            ISupportDrop dropTarget      = this.GetDropTarget(Control.MousePosition, out this.dropLocation);

            if (dropTarget == null || !this.IsDropTargetValid(dropTarget))
            {
                Cursor.Current = this.InvalidCursor;
                this.doCommit  = false;
                return;
            }

            if (dropTarget != null)
            {
                ISupportDrag draggedContext = this.Context as ISupportDrag;
                if (this.target != dropTarget)
                {
                    if (this.target != null)
                    {
                        this.target.DragLeave(oldDropLocation, draggedContext);
                    }

                    this.target = dropTarget;
                    this.target.DragEnter(this.dropLocation, draggedContext);
                }

                this.doCommit = this.target.DragOver(this.dropLocation, draggedContext);

                RadDragOverEventArgs args = new RadDragOverEventArgs(draggedContext, this.target);
                args.CanDrop = this.doCommit;
                this.OnPreviewDragOver(args);

                //use the CanDrop member of the event as it may be altered
                this.doCommit = args.CanDrop;

                if (this.doCommit)
                {
                    //TODO: Provide logic for updating cursor with events and DragDropEffects
                    Cursor.Current = this.ValidCursor;
                }
                else
                {
                    Cursor.Current = this.InvalidCursor;
                }
            }
            else
            {
                this.target   = null;
                this.doCommit = false;
            }
        }
Example #4
0
        private void DoDrag(Point mousePt)
        {
            object context1 = this.Context;

            this.SetHintWindowPosition(mousePt);
            Point        dropLocation = this.dropLocation;
            ISupportDrop dropTarget   = this.GetDropTarget(mousePt, out this.dropLocation);

            if (dropTarget == null || !this.IsDropTargetValid(dropTarget))
            {
                Cursor.Current = this.InvalidCursor;
                this.doCommit  = false;
            }
            else if (dropTarget != null)
            {
                ISupportDrag context2 = this.Context as ISupportDrag;
                if (this.target != dropTarget)
                {
                    if (this.target != null)
                    {
                        this.target.DragLeave(dropLocation, context2);
                    }
                    this.target = dropTarget;
                    this.target.DragEnter(this.dropLocation, context2);
                }
                this.doCommit = this.target.DragOver(this.dropLocation, context2);
                RadDragOverEventArgs e = new RadDragOverEventArgs(context2, this.target);
                e.CanDrop = this.doCommit;
                this.OnPreviewDragOver(e);
                this.doCommit = e.CanDrop;
                if (this.doCommit)
                {
                    Cursor.Current = this.ValidCursor;
                }
                else
                {
                    Cursor.Current = this.InvalidCursor;
                }
            }
            else
            {
                this.target   = (ISupportDrop)null;
                this.doCommit = false;
            }
        }