コード例 #1
0
        private void DoDragAndDropEnd(FrameworkElement dropTarget)
        {
            //  Get the event handler.
            DragAndDropDelegate dragAndDropEnd = DragAndDropEnd;

            //  If we have the event handler, fire it.
            if (dragAndDropEnd != null)
            {
                DragAndDropEventArgs args = new DragAndDropEventArgs()
                {
                    Allow       = true,
                    DragSource  = dragSource,
                    DragElement = dragElement,
                    DragData    = dragData,
                    DropTarget  = dropTarget
                };
                dragAndDropEnd(this, args);
            }

            //  We're done.
            dragging    = false;
            dragData    = null;
            dragElement = null;
            dragSource  = null;
            dropTarget  = null;
            dragAdorner = null;
        }
コード例 #2
0
ファイル: DragAndDropHost.cs プロジェクト: yatagarasu25/apex
        /// <summary>
        /// Continues drag and drop, calling the appropriate event if it is registered.
        /// </summary>
        /// <param name="potentialDropTarget">The potential drop target.</param>
        private void DoContinueDragAndDrop(FrameworkElement potentialDropTarget)
        {
            //  If we have a start handler, call it.
            DragAndDropDelegate dragAndDropContinue = DragAndDropContinue;

            if (dragAndDropContinue != null)
            {
                //  Create the drag and drop event args.
                DragAndDropEventArgs args = new DragAndDropEventArgs()
                {
                    DragSource  = dragSource,
                    DragElement = dragElement,
                    DragData    = dragData,
                    DropTarget  = potentialDropTarget,
                    Allow       = true
                };

                //  Call the event.
                dragAndDropContinue(this, args);

                //  If the operation has been disallowed, return.
                if (args.Allow == false)
                {
                    return;
                }
            }

            //  Store the potential drop target.
            dropTarget = potentialDropTarget;
        }
コード例 #3
0
ファイル: DragAndDropHost.cs プロジェクト: yatagarasu25/apex
        /// <summary>
        /// Starts drag and drop, calling the appropriate event if it is registered.
        /// </summary>
        /// <param name="dragSource">The drag source.</param>
        /// <param name="dragElement">The drag element.</param>
        /// <param name="dragData">The drag data.</param>
        private void DoDragAndDropStart(FrameworkElement dragSource, FrameworkElement dragElement,
                                        object dragData)
        {
            //  If we have a start handler, call it.
            DragAndDropDelegate dragAndDropStart = DragAndDropStart;

            if (dragAndDropStart != null)
            {
                //  Create the drag args.
                DragAndDropEventArgs args = new DragAndDropEventArgs()
                {
                    DragSource  = dragSource,
                    DragElement = dragElement,
                    DragData    = dragData,
                    Allow       = true
                };

                //  Call the event handler.
                dragAndDropStart(this, args);

                //  Has the operation been disallowed?
                if (args.Allow == false)
                {
                    //  todo extrapolate to function
                    dragging    = false;
                    dragData    = null;
                    dragElement = null;
                    dragSource  = null;
                    dropTarget  = null;
                    dragAdorner = null;
                    return;
                }

                //  Do we have an adorner?
                if (args.DragAdorner != null)
                {
                    //  Add the adorner.
                    dragAdorner = args.DragAdorner;
                    adornerLayer.AddAdorner(dragAdorner);
                }
            }

            //  Allow the drag.
            dragging = true;
        }
コード例 #4
0
        private void DoContinueDragAndDrop(FrameworkElement potentialDropTarget)
        {
            //  If we have a start handler, call it.
            DragAndDropDelegate dragAndDropContinue = DragAndDropContinue;

            if (dragAndDropContinue != null)
            {
                DragAndDropEventArgs args = new DragAndDropEventArgs()
                {
                    DragSource  = dragSource,
                    DragElement = dragElement,
                    DragData    = dragData,
                    DropTarget  = potentialDropTarget,
                    Allow       = true
                };
                dragAndDropContinue(this, args);
                if (args.Allow == false)
                {
                    return;
                }
            }

            dropTarget = potentialDropTarget;
        }