예제 #1
0
        //-----------------------------------------------------------------------
        public void DragStart(object sender, DragStartedEventArgs e)
        {
            if (DataItem is CollectionChildItem)
            {
                CollectionChildItem itemBase   = (CollectionChildItem)DataItem;
                DataItem            collection = itemBase.ParentCollection;

                if (collection != null)
                {
                    draggedImage = InsertionAdorner.ConvertElementToImage(this);

                    DataObject dragData = new DataObject("CollectionChildItem", DataItem);
                    dragData.SetData("Element", this);
                    DragDrop.DoDragDrop(this, dragData, DragDropEffects.Move);
                }
            }
            else if (DataItem is TreeItem)
            {
                TreeItem itemBase   = (TreeItem)DataItem;
                TreeItem collection = (TreeItem)itemBase.Parent;

                if (collection != null)
                {
                    draggedImage = InsertionAdorner.ConvertElementToImage(this);

                    DataObject dragData = new DataObject("TreeItem", DataItem);
                    dragData.SetData("Element", this);
                    DragDrop.DoDragDrop(this, dragData, DragDropEffects.Move);
                }
            }
            else if (DataItem is CommentItem)
            {
                CommentItem itemBase   = (CommentItem)DataItem;
                DataItem    collection = itemBase.Parent;

                if (collection != null && itemBase.CanReorder)
                {
                    draggedImage = InsertionAdorner.ConvertElementToImage(this);

                    DataObject dragData = new DataObject("CommentItem", DataItem);
                    dragData.SetData("Element", this);
                    DragDrop.DoDragDrop(this, dragData, DragDropEffects.Move);
                }
            }
        }
예제 #2
0
        //#############################################################################################
        #region Mouse Events

        //-----------------------------------------------------------------------
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            if (Data.Parent is CollectionChildItem && Data.Parent.Parent is GraphCollectionItem)
            {
                draggedImage = InsertionAdorner.ConvertElementToImage(this);

                DataObject dragData = new DataObject("GraphNodeData", Data.Parent);
                dragData.SetData("Element", this);
                DragDrop.DoDragDrop(this, dragData, DragDropEffects.Move);

                e.Handled = true;
            }
            else if (Data is CommentItem && Data.Parent is GraphCollectionItem)
            {
                draggedImage = InsertionAdorner.ConvertElementToImage(this);

                DataObject dragData = new DataObject("GraphNodeData", Data);
                dragData.SetData("Element", this);
                DragDrop.DoDragDrop(this, dragData, DragDropEffects.Move);

                e.Handled = true;
            }
        }