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

Stays on same Tab

1 Answer 52 Views
Dock
This is a migrated thread and some comments may be shown as answers.
dbernett
Top achievements
Rank 2
dbernett asked on 19 Oct 2012, 04:59 PM
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();
}

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 22 Oct 2012, 01:17 PM
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.
Tags
Dock
Asked by
dbernett
Top achievements
Rank 2
Answers by
Stefan
Telerik team
Share this question
or