Completed
Last Updated: 28 Oct 2014 15:29 by ADMIN
ADMIN
Dimitar
Created on: 08 May 2014 07:26
Category: Dock
Type: Bug Report
0
FIX. RadDock - when a tool window is dropped in the center to top, bottom, left or right docking guide, the window is docked as document window.
To reproduce:
- Dock a tool window in a black RadDock.
- Drag and drop the toolwindow in the top, bottom, right or left docking guides in the center.
- The tool window is docked as document window and fills the entire space.

Workaround:
public Form1()
{
    InitializeComponent();
    DragDropService service = this.radDock1.GetService<DragDropService>();

    service.PreviewHitTest += service_PreviewHitTest;
    
    radDock1.DockStateChanged += radDock1_DockStateChanged;
}

void radDock1_DockStateChanged(object sender, DockWindowEventArgs e)
{
    if (dropTarget is DocumentContainer)
    {
        if (position != null && position != "Fill")
        {
            e.DockWindow.DockState = DockState.Docked;
            switch (position)
            {
                case "Top":
                    radDock1.DockWindow(e.DockWindow, DockPosition.Top);
                    break;
                case "Left":
                    radDock1.DockWindow(e.DockWindow, DockPosition.Left);

                    break;
                case "Right":
                    radDock1.DockWindow(e.DockWindow, DockPosition.Right);

                    break;
                case "Bottom":
                    radDock1.DockWindow(e.DockWindow, DockPosition.Bottom);
                    break;
            }
            position = null;
        }
    }
}

string position = null;
object dropTarget = null;

void service_PreviewHitTest(object sender, DragDropHitTestEventArgs e)
{
    if (e.HitTest.GuidePosition != null)
    {
        dropTarget = e.DropTarget;
        position = e.HitTest.DockPosition.Value.ToString();
        Console.WriteLine(e.DropTarget);
    }
}
0 comments