Completed
Last Updated: 11 Mar 2014 11:30 by ADMIN
ADMIN
Georgi I. Georgiev
Created on: 17 Oct 2013 10:18
Category: Dock
Type: Bug Report
0
FIX. RadDock - Dragging document tabs leaves RadDock in invalid state
To reproduce: Add RadDock to a form. Add a few DocumentWindows. Drag a tab among the other tabs and you will see how the cursor is a different, that is normal. Drag a tab to the content area of the document window and you will see the docking guides. Now if you drag the tab again over the other tabs you will see that the docking guides are still visible and the cursor is not changing (except if you drag outside of the dock).

Resolution: 
1. Inherit RadPageViewInDockDragDropService and override the UpdateCursor virtual method. 
class MyDragDropService : RadPageViewInDockDragDropService
    {
        RadPageViewElement owner;

        public MyDragDropService(RadPageViewElement owner) : base(owner)
        {
            this.owner = owner;
        }

        protected override void UpdateCursor(Point mousePos)
        {
            RadPageViewStripElement stripElement = this.owner as RadPageViewStripElement;
            if (stripElement == null)
            {
                return;
            }

            if (!this.processing)
            {
                //Cursor.Current = Cursors.Default;
                return;
            }

            Point mousePt = Control.MousePosition;
            if (this.owner.IsInValidState(true))
            {
                mousePt = this.owner.ElementTree.Control.PointToClient(mousePt);
            }
            else
            {
                mousePt = mousePos;
            }

            if (!stripElement.ItemContainer.ControlBoundingRectangle.Contains(mousePt))
            {
                Cursor.Current = Cursors.Default;
                base.HintWindow.BackgroundImage = null;
                base.HintWindow.Hide();
                this.processing = false;
            }
        }
    }
2. Change the nested PageView in RadDock 
public Form2()
{
    InitializeComponent();

    radDock1.GetService<DragDropService>().Starting += (sender, args) =>
    {
        if ((sender as DragDropService).DragDropContext == DragDropContext.DocumentWindow)
        {
            args.Cancel = true;
        }
    };

    foreach (Control child in ControlHelper.EnumChildControls(this.radDock1, true))
    {
        DocumentTabStrip docStrip = child as DocumentTabStrip;
        if (docStrip != null)
        {
            RadPageViewElement pageViewElement = docStrip.TabStripElement;
            pageViewElement.ItemDragService = new MyDragDropService(pageViewElement);
        }
    }
}
0 comments