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

Setting the size of a DockPanel in a docked state at runtime

6 Answers 595 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 17 Sep 2008, 07:32 PM

How do I set the Size of a DockPanel in a docked state at runtime?  Here's my simple code.

panel = new Telerik.WinControls.Docking.DockPanel();

panel.DockState = Telerik.WinControls.Docking.

DockState.Docked;
panel.Size = new Size(250, 250);

For some reason the Size is not set.  It just remains the same.

Thanks,
Ryan

6 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 19 Sep 2008, 03:16 PM
Hello Ryan,

Please attach the created DockPanel to the DockingManager before you set its Size property:

 panel = new Telerik.WinControls.Docking.DockPanel(); 
 dockingManager1.SetDock(panel, DockPosition.Left); 
 panel.Size = new Size(250, 250); 

On a side note, please ask the purchase holder in your company you have obtained our products from to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system. Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: www.telerik.com/faq.


Sincerely yours,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ryan
Top achievements
Rank 1
answered on 26 Sep 2008, 07:53 PM
Thanks for the quick reply. 

The DockPanel is already attached to a DockingManager and I already call SetDock.  The Size still does not get set. 
0
Julian Benkov
Telerik team
answered on 29 Sep 2008, 08:28 PM
Hi Ryan,

Please send us a simple example with your layout RadDock scheme to reproduce problem locally. Thank you in advance.

Sincerely yours,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Ryan
Top achievements
Rank 1
answered on 03 Oct 2008, 06:37 PM
I have a form with a dockManager that contains 3 dockPanels.  dockPanel1 is docked on the left.  dockPanel2 is docked on the right.  dockPanel3 is docked on the bottom.  When the code below runs the width of dockPanel3 does not change to half its current width as expected.  Is there a way to set the size?

//This code is in the windows Form
protected

override void OnLoad(EventArgs e)

{

    base.OnLoad(e);

    dockPanel3.DockState = Telerik.WinControls.Docking.

DockState.Docked;

    dockPanel3.DockManager.SetDock    
(dockPanel3,     Telerik.WinControls.Docking.

DockPosition.Bottom);

    dockPanel3.Size =

new Size(dockPanel3.Width / 2, dockPanel3.Height);

}

0
John
Top achievements
Rank 1
answered on 06 Oct 2008, 05:21 AM
Ryan,
     If you set dockPanel3 to dock on the bottom it will fill the entire bottom of the DockingManager, so you cannot set the size.  I am assuming you are wanting to have a three panel layout where dockPanel1 and dockPanel3 share the same vertical area while dockPanel2 fills the remaining area, or some variation of this layout.  If that is correct, I have provided an XML layout below.  An easy way to build your layout is to use the Advanced Layout Designer which is accessible from the DockingManager SmartTag menu.  You can call the SaveXML and LoadXML methods once you have the layout how you like it.  I hope this helps. 

dockingManager1.LayoutTree = "<?xml version=\"1.0\" encoding=\"utf-8\"?><DockingTree xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><Sites Type=\"Telerik.WinControls.Docking.AutoHideContent\" Assembly=\"Telerik.WinControls.Docking, Version=7.1.1.0, Culture=neutral, PublicKeyToken=5bb2a467cbec794e\"><Sites Orientation=\"Horizontal\" Size=\"501;395\" HidePosition=\"0\"><Dockables /><Rigth Orientation=\"Horizontal\" Size=\"501;395\" HidePosition=\"0\"><Dockables /><Left Orientation=\"Vertical\" Size=\"236;395\" HidePosition=\"0\"><Dockables /><Left Orientation=\"Horizontal\" Size=\"236;192\" HidePosition=\"Left\"><Dockables><XmlDockable Text=\"dockPanel1\" DockState=\"Docked\" DockPosition=\"Left\" PreferredDockSize=\"100;200\" PreferredFloatSize=\"150;300\" Guid=\"07d9e734-e472-4926-950d-f32f00d3cb6f\" Type=\"Telerik.WinControls.Docking.DockPanel\" Assembly=\"Telerik.WinControls.Docking, Version=7.1.1.0, Culture=neutral, PublicKeyToken=5bb2a467cbec794e\" CaptionVisible=\"True\" TabStripVisible=\"True\" CloseButtonVisible=\"True\" HideButtonVisible=\"True\" DropDownButtonVisible=\"True\" /></Dockables></Left><Rigth Orientation=\"Horizontal\" Size=\"236;199\" HidePosition=\"Left\"><Dockables><XmlDockable Text=\"dockPanel3\" DockState=\"Docked\" DockPosition=\"Bottom\" PreferredDockSize=\"100;200\" PreferredFloatSize=\"150;300\" Guid=\"73a56b8e-759b-435c-b206-f0e02d58366d\" Type=\"Telerik.WinControls.Docking.DockPanel\" Assembly=\"Telerik.WinControls.Docking, Version=7.1.1.0, Culture=neutral, PublicKeyToken=5bb2a467cbec794e\" CaptionVisible=\"True\" TabStripVisible=\"True\" CloseButtonVisible=\"True\" HideButtonVisible=\"True\" DropDownButtonVisible=\"True\" /></Dockables></Rigth></Left><Rigth Orientation=\"Horizontal\" Size=\"261;395\" HidePosition=\"Right\"><Dockables><XmlDockable Text=\"dockPanel2\" DockState=\"Docked\" DockPosition=\"Right\" PreferredDockSize=\"100;200\" PreferredFloatSize=\"150;300\" Guid=\"a1696d86-ad3a-42b1-bdff-4416c33bfb20\" Type=\"Telerik.WinControls.Docking.DockPanel\" Assembly=\"Telerik.WinControls.Docking, Version=7.1.1.0, Culture=neutral, PublicKeyToken=5bb2a467cbec794e\" CaptionVisible=\"True\" TabStripVisible=\"True\" CloseButtonVisible=\"True\" HideButtonVisible=\"True\" DropDownButtonVisible=\"True\" /></Dockables></Rigth></Rigth></Sites></Sites></DockingTree>";
0
Julian Benkov
Telerik team
answered on 06 Oct 2008, 03:21 PM
Hi Ryan,

The solution provided by John is absolutely correct. Thank you, John!

When you dock DockPanel to the Top or Bottom zone, you can change the Height, but not the Width. For Left- and Right-docked DockPanels you can change the Width only.

Feel free to contact us if you have additional questions.

 
Regards,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Ryan
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Ryan
Top achievements
Rank 1
John
Top achievements
Rank 1
Share this question
or