Nevron .NET Vision
User Interface for .NET / User's Guide / Docking Panels / Docking Containers

In This Topic
    Docking Containers
    In This Topic
     
     Overview
    The container that hosts docking panels is the NDockingPanelContainer class. It hosts a tree of docking zones which forms the layout of the container. Adding zones and panels to the container is pretty simple - all zones and panels share a common interface model - both zones and panels implement INDockZoneChild.
     Adding Panels

    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)
    
    For more information about docking zones see Docking Zones.
     Nested Containers

    Nevron docking panels are the only suite on the market which allows for nested containers making you completely unrestricted regarding any complex layouts.

    You will seldom (if ever) need nested containers.
    See Also