Recommended way of creating and docking windows from code is to use method DockSite.Dock and pass in DockWindow as well as docking specification and control will perform all work for you. If you insist on creating all structures from code note following.

When creating the DotNetBar for WPF docking windows from code make sure that you create proper parent/child hierarchy controls. The parent child relationship expected by the control is as follows:

DockSite
SplitPanel
DockWindowGroup
DockWindow

For example to create the document dock window you would use following code:

SplitPanel splitPanel = new SplitPanel();
DockWindowGroup dg = new DockWindowGroup();
DockWindow dw = new DockWindow();
dw.Header = "Document Window";
// Assign Dock Document content
dw.Content = myContent;
dg.Items.Add(dw);
splitPanel.Children.Add(dg);
MyDockSite.Content = splitPanel;
// Select the newly created dock window
dw.IsSelected = true;
dg.UpdateVisibility();

To create an dockable window docked to the right you would use following code:

SplitPanel splitPanel = new SplitPanel();
DockWindowGroup dg = new DockWindowGroup();
DockWindow dw = new DockWindow();
dw.Header = "Dock Window";
// Assign Dock Window content
dw.Content = myContent;
dg.Items.Add(dw);
splitPanel.Children.Add(dg);
// Dock SplitPanel to the right side
DockSite.SetDock(splitPanel, Dock.Right);
// Set inital split panel size, since control is docked to the right number specified indicates width
DockSite.SetDockSize(splitPanel, 150);
MyDockSite.SplitPanels.Add(splitPanel);
dg.UpdateVisibility();

 

Related posts:

  1. How To Start Using Wpf-Dock Control
  2. Docking Control support for Windows Forms or other windowed controls in DotNetBar for WPF
  3. Key Wpf-Dock DockWindow Properties, Events and Commands
  4. How to Create WPF Navigation Pane Items Using Code
  5. How to access WPF Dock Floating Window