NDockingPanel instances cannot be added directly to containers. Build a docking zones tree instead and add panels to NDockingPanelHost objects. The zones tree is very intuitive and easy to build. Layout logic is mainly divided into two parts depending on orientation - horizontal and vertical. Each container has an embedded root dock zone which fills its interior. Use this zone for building your own custom layouts.
The following diagram visualizes a dock zone tree within a NDockingPanelContainer:
And the following code demonstrates how to implement the layout above programmatically:
C# |
Copy Code
|
---|---|
//create a dock manager NDockManager manager = new NDockManager(); manager.Form = this; //get reference to the root container which is already automatically added to the form's controls collection. NDockingPanelContainer container = manager.RootContainer; //create a dock zone with vertical orientation NDockZone zone = new NDockZone(Orientation.Vertical); //add this zone to the container's root zone container.RootZone.AddChild(zone); //create two docking panels hosts and add them to the zone NDockingPanelHost host1 = new NDockingPanelHost(); NDockingPanelHost host2 = new NDockingPanelHost(); //add hosts to the zone with vertical orientation zone.AddChild(host1); zone.AddChild(host2); //create two docking panels and add them to the newly created hosts NDockingPanel panel1 = new NDockingPanel(); host1.AddChild(panel1); NDockingPanel panel2 = new NDockingPanel(); host2.AddChild(panel2); //create a docking panel host and add it to the root zone NDockingPanelHost host3 = new NDockingPanelHost(); container.RootZone.AddChild(host3); //add a docking panel to the third host NDockingPanel panel3 = new NDockingPanel(); host3.AddChild(panel3); |
Visual Basic |
Copy Code
|
---|---|
'create a dock manager Dim manager As NDockManager = New NDockManager() manager.Form = Me 'get reference to the root container which is already automatically added to the form's controls collection. Dim container As NDockingPanelContainer = manager.RootContainer 'create a dock zone with vertical orientation Dim zone As NDockZone = New NDockZone(Orientation.Vertical) 'add this zone to the container's root zone container.RootZone.AddChild(zone) 'create two docking panels hosts and add them to the zone Dim host1 As NDockingPanelHost = New NDockingPanelHost() Dim host2 As NDockingPanelHost = New NDockingPanelHost() 'add hosts to the zone with vertical orientation zone.AddChild(host1) zone.AddChild(host2) 'create two docking panels and add them to the newly created hosts Dim panel1 As NDockingPanel = New NDockingPanel() host1.AddChild(panel1) Dim panel2 As NDockingPanel = New NDockingPanel() host2.AddChild(panel2) 'create a docking panel host and add it to the root zone Dim host3 As NDockingPanelHost = New NDockingPanelHost() container.RootZone.AddChild(host3) 'add a docking panel to the third host Dim panel3 As NDockingPanel = New NDockingPanel() host3.AddChild(panel3) |
Nevron docking panels are the only suite on the market which allows for nested containers making you completely unrestricted regarding any complex layouts.