This is a migrated thread and some comments may be shown as answers.

RadDock, Programmatically set DockPosition

2 Answers 266 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Mattias Hermansson
Top achievements
Rank 1
Mattias Hermansson asked on 20 Sep 2012, 07:43 AM
I've been playing around with RadDock and not been able to get my head around this control...

Here is my scenario( bit simplyfied):

I've got a RadDock, which I add usercontrols to:

UserControlPlugInDemo ucpid = new UserControlPlugInDemo();
DockPosition dockTo = DockPosition.Fill;
this.radDock1.DockControl(ucpid, dockTo, DockType.Document);

Then, when a user click on a button in one of these, to open a map, I add a new tab containing map with DockPosition.Right.
This works fine.

But next time I add a usercontrol, I want it to Fill(like merging Map with the others tabs), but it adds to the active DockWindow, either o the right or left.

Any tip would be apreciated!

2 Answers, 1 is accepted

Sort by
0
Mattias Hermansson
Top achievements
Rank 1
answered on 22 Sep 2012, 06:08 PM
Sorry, after reading a little in other post and "playing" around with demos, I realized that I should avail myself of the radDock1.DockWindow() instead.
0
Accepted
Nikolay
Telerik team
answered on 24 Sep 2012, 03:51 PM
Hello Anders,

I am not sure if your last message would mean that you have resolved your case, but still as far as I understand your requirement, here is what you can do:

ToolTabStrip rightHandStrip = null;
 
private void radButton1_Click(object sender, EventArgs e)
{
    Map1UC map1 = new Map1UC();
    ToolWindow twMap1 = new ToolWindow();
    twMap1.Controls.Add(map1);
    if (rightHandStrip == null)
    {
        this.radDock1.DockWindow(twMap1, DockPosition.Right);
        rightHandStrip = (ToolTabStrip)twMap1.Parent;
    }
    else
    {
        this.radDock1.DockWindow(twMap1, rightHandStrip, DockPosition.Fill);
    }
}
 
void radButton2_Click(object sender, EventArgs e)
{
    Map2UC map2 = new Map2UC();
    ToolWindow twMap2 = new ToolWindow();
    twMap2.Controls.Add(map2);
    if (rightHandStrip == null)
    {
        this.radDock1.DockWindow(twMap2, DockPosition.Right);
        rightHandStrip = (ToolTabStrip)twMap2.Parent;
    }
    else
    {
        this.radDock1.DockWindow(twMap2, rightHandStrip, DockPosition.Fill);
    }
}

Basically, you should get the right ToolTabStrip the first time you need such, and then reuse it for docking the rest of the windows there. This will allow you to place all new 'map' controls in a common container positioned at right in RadDock.

I hope this helps. Greetings,
Nikolay
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Dock
Asked by
Mattias Hermansson
Top achievements
Rank 1
Answers by
Mattias Hermansson
Top achievements
Rank 1
Nikolay
Telerik team
Share this question
or