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

Dock left or as additional tab to existing left docked window

2 Answers 78 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 13 Mar 2012, 11:31 PM
I am new to Telerik controls and am working my way through the documentation as writing a project with the controls.

Our Dock panel will start empty and new tabbed documents and tool windows will be added in code (docking user controls). If a new tool window is added i need to dock it to the left. But, if a tool window already exists docked to the left then I need the new window to become a tab, rather than docking between that and the main window.

Imagine I have 3 user controls A, B, C, multiple sopies of which may be instantiated as a tool window. Each time an addition one is instantiated, i need to to add itself to the tabs. but, of course, if it is the first then it needs to simply dock left.

If anybody can help with this, that would be great!

Thank you in advance
Tony

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 16 Mar 2012, 02:01 PM
Hello Tony,

Thank you for writing.

Your scenario is easily achievable. Simply, the first time when you add window, add it to with DockPosition.Left and then when adding the additional windows, dock them to the first tool window with DockPosition.Fill:
private void radButton1_Click(object sender, EventArgs e)
{
    if (radDock1.DockWindows.Count == 0)
    {
        UserControl1 uc = new UserControl1();
        HostWindow host = this.radDock1.DockControl(uc, Telerik.WinControls.UI.Docking.DockPosition.Left);
        host.Text = DateTime.Now.ToShortDateString(); ;
    }
    else
    {
        UserControl1 uc = new UserControl1();
        HostWindow host = this.radDock1.DockControl(uc,radDock1.DockWindows[0], Telerik.WinControls.UI.Docking.DockPosition.Fill);
        host.Text = DateTime.Now.ToShortDateString();
    }
}

I hope that you find this information useful. Let me know if I can be of further assistance.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Tony
Top achievements
Rank 1
answered on 16 Mar 2012, 02:16 PM
Hi Stefan,
Looks great, thank you!  I'll try it out real soon.

regards
Tony
Tags
Dock
Asked by
Tony
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Tony
Top achievements
Rank 1
Share this question
or