Dock left or as additional tab to existing left docked window

3 posts, 0 answers
  1. Tony
    Tony avatar
    4 posts
    Member since:
    Oct 2012

    Posted 13 Mar 2012 Link to this post

    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. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 16 Mar 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tony
    Tony avatar
    4 posts
    Member since:
    Oct 2012

    Posted 16 Mar 2012 Link to this post

    Hi Stefan,
    Looks great, thank you!  I'll try it out real soon.

    regards
    Tony
Back to Top