Loop through all dockpanels

2 posts, 0 answers
  1. kortm
    kortm avatar
    6 posts
    Member since:
    Feb 2007

    Posted 30 Mar 2007 Link to this post

    I want to loop through all the dock panels that are in the docking manager in order to remove the hidden panel.
    I try to use the PrimarySite Property:  
    foreach (IDockable document1 in (dockingManager1.PrimarySite as DockSite).Documents)
    if (document1.DockState == DockState.Hidden)
    I can't seem to get that to work.  Any help would be appreciated.

    in other words, how can I get a panel from the dockmanager ?
  2. Julian Benkov
    Julian Benkov avatar
    1135 posts

    Posted 30 Mar 2007 Link to this post

    Hello Kort,

    Your code is correct, but it is valid only for DockPanels and any IDockable windows which inherit from DockType.ToolWindow. When you close a window of type DockType.Document (e.g. DocumentPane) it is automatically removed from the docking manager.

    If you would like to go through all the other windows you should do the following:
    foreach (IDockable window in dockingManager1.GetManagedDockables())  
        if (window.DockState != DockState.Docked || window.DockState != DockState.TabbedDocument || window.DockState != DockState.AutoHide)  
            //unregister window from docking manager  
            //dispose the window  
            Control ctrl = window as Control;  
            if (ctrl != null)  

    All the best,
    Julian Benkov
    the telerik team

    Instantly find answers to your questions at the new telerik Support Center
Back to Top