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;
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);
However, note that you do not need to create complete structures in code. You can use shortcut method DockSite.Dock and pass in DockWindow as well as docking specification and control will perform all work for you.
Related posts:
- How To Start Using Wpf-Dock Control
- Docking Control support for Windows Forms or other windowed controls in DotNetBar for WPF
- Key Wpf-Dock DockWindow Properties, Events and Commands
- How to Create WPF Navigation Pane Items Using Code
- How to access WPF Dock Floating Window
Reference:http://www.devcomponents.com/kb2/?p=387