How to change the index of the Tabbed window programmatically in DockingManager
By default, newly added Tabbed Dock Windows will be arranged at right side of the existing tab in DockingManager. We can change the order of the Tabbed Dock window in DockingManager by insert the new tab or desired tab in the desired index of TabControlAdv. TabControlAdv is used to arrange the Tabbed dock windows in DockingManager. The following code explains how to add new tabbed window into left side of the existing tab,
Form.cs:
void AddChildToDockingManager(int i) { for(int j = 1; j<=i;j++) { Panel panel = GetPanel(j); this.dockingManager1.DockControl(panel, pan, DockingStyle.Tabbed, 20); DockTabControl docktab; DockHost dhost = panel.Parent as DockHost; if (dhost != null) { DockHostController dhc = dhost.InternalController as DockHostController; if (dhc != null && dhc.ParentController is DockTabController) { docktab = (dhc.ParentController as DockTabController).TabControl; TabPageAdv page = docktab.TabPages[0]; docktab.TabPages.RemoveAt(0); docktab.TabPages.Insert(docktab.TabPages.Count, page); docktab.SelectedIndex = 0; dockingManager1.ActivateControl(pan); } } } } Panel GetPanel(int i) { Panel panel = new Panel(); panel.Name = "Panel" + i; CaptionButtonsCollection ccbpanel = new Syncfusion.Windows.Forms.Tools.CaptionButtonsCollection(); this.dockingManager1.SetDockLabel(panel, "Dock Panel" +i); this.dockingManager1.SetEnableDocking(panel, true); ccbpanel.MergeWith(this.dockingManager1.CaptionButtons, false); this.dockingManager1.SetCustomCaptionButtons(panel, ccbpanel); return panel; }
Screenshot:
The following screenshot shows the default order of the Tabbed window,
The following screenshot shows the new order of the tabbed window,
Samples: