Stays on same Tab

2 posts, 0 answers
  1. dbernett
    dbernett avatar
    11 posts
    Member since:
    Oct 2008

    Posted 19 Oct 2012 Link to this post

    This code works but user does not move to that new tab.  After the tab is added it has to be clicked on to view?  What am I doing wrong?

    private void Form1_Load(object sender, EventArgs e)
    {
        this.IsMdiContainer = true;
        this.radDock1.AutoDetectMdiChildren = true;
    }

    private void radMenuItem1_Click(object sender, EventArgs e)
    {
        Form childForm = new Form();
        childForm.Text = "MDI Child " + DateTime.Now.ToShortTimeString();
        childForm.MdiParent = this;
        childForm.Show();
    }
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Oct 2012 Link to this post

    Hi David,

    Thank you for writing.

    You should use the DockWindowAdded event to set the newly added window as active:
    private void radButtonElement1_Click(object sender, EventArgs e)
    {
        MyForm form = new MyForm();
        form.MdiParent = this;
        form.Text = DateTime.Now.ToString();
        form.Show();
     
        radDock1.DockWindowAdded += new Telerik.WinControls.UI.Docking.DockWindowEventHandler(radDock1_DockWindowAdded);
    }
     
    void radDock1_DockWindowAdded(object sender, Telerik.WinControls.UI.Docking.DockWindowEventArgs e)
    {
        radDock1.ActiveWindow = e.DockWindow;
    }

    I hope this helps.
     
    All the best,
    Stefan
    the Telerik team
    You’ve been asking for it and now it’s time for us to deliver. RadControls for WinForms Q3 2012 release is just around the corner. Sign up for a free webinar to see first all the latest enhancements.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top