private void BeginDrag(MouseEventArgs e)
        {
            this.initialMousePosition = new Point(e.X, e.Y);
            RadElement elementAtPoint = sourceComponentElementTree.GetElementAtPoint(this.initialMousePosition);

            if (elementAtPoint == null)
            {
                return;
            }
            else
            {
                if ((elementAtPoint.Visibility != ElementVisibility.Visible))
                {
                    return;
                }
            }

            if (elementAtPoint is RadListElement)
            {
                return;
            }
            if (elementAtPoint is RadListVisualItem)
            {
                sourceListBox.SelectedItem = (elementAtPoint as RadListVisualItem).Data;
            }

            this.draggedItem = (elementAtPoint as RadListVisualItem).Data;

            DragCancelEventArgs args = new DragCancelEventArgs(this.draggedItem, null);

            if (args.Cancel)
            {
                this.draggedItem = null;
                return;
            }

            RadDragEventArgs dragArgs = new RadDragEventArgs(this.draggedItem, null);

            this.isRealDrag = false;

            this.dragging = true;

            if (this.feedBackForm == null)
            {
                feedBackForm = new FeedBackForm();
            }

            this.colorToSet             = this.FeedbackFormLineColor();
            this.feedBackForm.LineColor = this.colorToSet;

            if (this.draggedItem != null)
            {
                PrepareDragging(e);
            }
        }
        private void RefreshItemsAfterDragDrop(MouseEventArgs e)
        {
            if (this.draggedItem == this.replacedItem)
            {
                return;
            }

            DragCancelEventArgs args = new DragCancelEventArgs(this.draggedItem, this.replacedItem);

            if (args.Cancel)
            {
                this.draggedItem  = null;
                this.replacedItem = null;
                return;
            }

            if (replacedItem != null)
            {
                int replacedItemIndex = targetListBox.Items.IndexOf(this.replacedItem);
                int draggedItemIndex  = sourceListBox.Items.IndexOf(this.draggedItem);
                int UpperBound        = replacedItem.VisualItem.Bounds.Height * replacedItemIndex;
                int MiddleBound       = UpperBound + replacedItem.VisualItem.Bounds.Height / 2;

                if (sourceListBox == targetListBox && draggedItemIndex == replacedItemIndex)
                {
                    return;
                }
                sourceListBox.Items.RemoveAt(draggedItemIndex);

                Point p1 = new Point();
                p1.X = e.X;
                p1.Y = e.Y;

                if (p1.Y <= MiddleBound && p1.Y > UpperBound)
                {
                    if (sourceListBox == targetListBox)
                    {
                        //the dragged item should be added above the replaced item
                        if (draggedItemIndex < replacedItemIndex)
                        {
                            targetListBox.Items.Insert(replacedItemIndex - 1, this.draggedItem);
                        }
                        else
                        {
                            targetListBox.Items.Insert(replacedItemIndex, this.draggedItem);
                        }
                    }
                    else
                    {
                        targetListBox.Items.Insert(replacedItemIndex, this.draggedItem);
                    }
                }
                else
                {
                    if (sourceListBox == targetListBox)
                    {
                        //the dragged item should be added below the replaced item
                        if (draggedItemIndex > replacedItemIndex)
                        {
                            targetListBox.Items.Insert(replacedItemIndex + 1, this.draggedItem);
                        }
                        else
                        {
                            targetListBox.Items.Insert(replacedItemIndex, this.draggedItem);
                        }
                        //targetListBox.Items.Insert(replacedItemIndex, this.draggedItem);
                    }
                    else
                    {
                        targetListBox.Items.Insert(replacedItemIndex + 1, this.draggedItem);
                    }
                }
            }
            else
            {
                int idx = sourceListBox.Items.IndexOf(this.draggedItem);
                sourceListBox.Items.RemoveAt(idx);
                targetListBox.SelectedItem = null;
                targetListBox.Items.Add(this.draggedItem);
            }
            targetListBox.SelectedIndex = -1;
            targetListBox.SelectedItem  = draggedItem;

            this.draggedItem  = null;
            this.replacedItem = null;
        }