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

Runtime: Set size and position of floating DockPanel

1 Answer 173 Views
Dock
This is a migrated thread and some comments may be shown as answers.
stealthsid
Top achievements
Rank 1
stealthsid asked on 21 May 2008, 10:26 PM
I cannot figure out how to set the size or position (in pixels, not snapped to the top, left, bottom, or right) of a floating DockPanel which was created at runtime.

Below is how I'm instantiating the DockPanel (the DeckWorkspace is a valid UserControl... part of CAB, "docked" and "auto-hide" are bools). I have tried setting Size, but that only appears to control the private "dockSize" member, and obviously I don't have access to the private "floatSize" member.


DockPanel panel = new DockPanel();

DeckWorkspace workspace = new DeckWorkspace();

workspace.Name = workspaceName;

workspace.Dock = DockStyle.Fill;

panel.Controls.Add(workspace);

dockingManager1.PrimarySite.DockingManager.SetDock(panel, DockPosition.Default);

panel.DockState = (docked) ? DockState.Docked : DockState.Floating;

panel.DockState = (autoHide) ? DockState.Docked & DockState.AutoHide : panel.DockState;

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 22 May 2008, 12:54 PM
Hi stealthsid,

You can use the Size property of DockPanel or any IDockable window, but when the window is docked and its DockPosition is not Fill.

When an IDockable window is in a floating container, you may get the HostForm from the DockingSite property and change its size:

if(dockPanel1.DockingSite.HostFrom != null)  
{  
    dockPanel1.DockingSite.HostForm.Size = new Size(300,300);  

I hope this helps. If you have additional questions, please contact us.

All the best,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Dock
Asked by
stealthsid
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or