This is a migrated thread and some comments may be shown as answers.

How do I add a DockZone to a Dock?

4 Answers 105 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Christoffer Rosenqvist
Top achievements
Rank 1
Christoffer Rosenqvist asked on 26 Oct 2009, 04:28 PM
I have a RadDockLayout where I have a DockZone. Inside this DockZone I add a Dock - so far, so good - now I want to add a new DockZone to the Dock and thus allow nested Docks. All of this happens programmatically from code behind.

So far I haven't succeeded. How is this done? Where do I add the new DockZone to the Dock? Do I add it to the Controls-collection or somehow to the ContentTemplate? Please illustrate with an example.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Christoffer Rosenqvist
Top achievements
Rank 1
answered on 27 Oct 2009, 09:37 AM
It seems the method is this:
dock.ContentContainer.Controls.Add(dockZone); 

Correct?
0
Christoffer Rosenqvist
Top achievements
Rank 1
answered on 27 Oct 2009, 09:57 AM
I have yet another problem: I add a DockZone to a Dock using the previous code, then I add a Dock to the new DockZone - no problem. The problem is that when I move the Dock out from the dynamically created DockZone I can't move it back in. The DockZone won't accept any Docks to be dropped inside it. Is it lacking any parameters then?

Here is my code:

        private void AddTargetGroupDockZone(RadDock dock) { 
            RadDockZone dockZone = CreateDockZone(); 
            dockZone.MinHeight = Unit.Pixel(70); 
            dockZone.Width = Unit.Pixel(500); 
            dock.ContentContainer.Controls.Add(dockZone); 
        } 
 
        private RadDockZone CreateDockZone() { 
            RadDockZone dockZone = new RadDockZone(); 
            dockZone.UniqueName = Guid.NewGuid().ToString(); 
            dockZone.ID = string.Format(DockZoneIDFormat, dockZone.UniqueName); 
            return dockZone; 
        } 

0
Christoffer Rosenqvist
Top achievements
Rank 1
answered on 27 Oct 2009, 02:31 PM
It seems that if I add the "main" RadDockZone to the ForbiddenZones of the inner most Docks everything seems to be working as it should. Don't understand why though. Explanation?

dock.ForbiddenZones = new[] { rdzMain.UniqueName }; 

0
Pero
Telerik team
answered on 29 Oct 2009, 09:21 AM
Hello Christoffer,

If you want to add controls to the RadDock, you need to add them to the Controls collection of the dock's ContentContainer, exactly like you have done in some of your previous posts.

The problem with the dock not docking in the correct zone might be caused by the fact that the docks are not correctly associated with the ID of the dynamically created RadDockZone. Please use the same value for the zone.UniqueName and zone.ID. If this does not solve the problem, please open a new support ticket and send us a sample running project where the problem can be observed.


All the best,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Dock
Asked by
Christoffer Rosenqvist
Top achievements
Rank 1
Answers by
Christoffer Rosenqvist
Top achievements
Rank 1
Pero
Telerik team
Share this question
or