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

Loop through all dockpanels

1 Answer 175 Views
Dock
This is a migrated thread and some comments may be shown as answers.
kortm
Top achievements
Rank 1
kortm asked on 30 Mar 2007, 10:24 AM
  Hello,
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)
{dockingManager1.Remove(document1);}
}
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 ?
Thanks,
KORT

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 30 Mar 2007, 04:02 PM
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  
        dockingManager1.Remove(window);  
 
        //dispose the window  
        Control ctrl = window as Control;  
        if (ctrl != null)  
        {  
            ctrl.Dispose();  
        }  
    }  

All the best,
Julian Benkov
the telerik team

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