Runtime: Set size and position of floating DockPanel

2 posts, 0 answers
  1. stealthsid
    stealthsid avatar
    21 posts
    Member since:
    Oct 2006

    Posted 21 May 2008 Link to this post

    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;


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

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

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

  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 22 May 2008 Link to this post

    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
  3. DevCraft banner
Back to Top