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

number of controls docked in Doc panel

3 Answers 69 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Sasmita
Top achievements
Rank 1
Sasmita asked on 22 Jul 2008, 09:59 PM

Hi ,

I have one docked panel on a docking manager. On button click I am docking forms to the doc panel.  At a given point of time I want to know how many forms are docked in the doc panel. 

I tried with dockingManager1.ActiveControl, dockingManager1.GetManagedDockables (), dockingManager1.Controls it did not help.

Could you please help me knowing the procedure for knowing it ?

Thanks,
Sasmita

 

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 24 Jul 2008, 09:21 AM
Hi Sasmita,

The dockingManager1.GetManagedDockables () method will return you all IDockable windows hosted in RadDock. If you want to get only TabbedDocuments created in DockingManager you can use its Documents property.

Please send us a simple example describing the details of your scenario. Thank you in advance.

All the best,
Julian Benkov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Sasmita
Top achievements
Rank 1
answered on 31 Jul 2008, 06:51 PM
Hi,

Dockmanager.Document property does not retrive me anything. Count is coming as null.

I have an indows application. I am using a dock manager which is having a Dock panel. There is a button called "Open Window". Each time i click on Open window, i create one instance of a User Control and docks it in the DockPanel.

For the first time when i click the button, it creates one instance of the user control and docks it at the Top and for all subsequest  click,  it creates instance of the User Controls and Docks just below the first window.

My Requirement is if for the First time i have clicked on the "Open Window" and one instance is docked in the Dock manager then next time when i click the button the nect window should not be docked below it, it should be floating..
So for that i need to know how many user controls are docked corrently in the Dock Manager. 
dockingManager1.DockingSites Property gives me the List, but if i close the instances also, it retains the list.

So is there any way i can know whether any control is docked or not in docking manager.

Any kind of help is appreciated.

Sasmita



0
Angel
Telerik team
answered on 04 Aug 2008, 02:07 PM
Hello Sasmita,

Use GetManagedDockables (DockState).Count to get the number of added and docked panels.
A sample code is given below:

DockPanel dp = new DockPanel();     
// Add your user control in dp.Controls  
 
this.dockingManager1.SetDock(dp, DockPosition.Top);  
if (this.dockingManager1.GetManagedDockables(DockState.Docked).Count > 1)  
{  
    Point pos = this.dockingManager1.PointToScreen(Point.Empty);  
    pos.Offset(100, 40);  
    this.dockingManager1.Float(dp, pos, this.dockingManager1.Size);  

All dock panels after the first one will be floating. Manage the position of the floating form at your will - it is in screen coordinates.

Note that when closing a DockPanel it is not released (disposed). It is just hidden and later it can be shown.
If you wish to close and dispose the user controls - handle the DockingStateChanged event and remove the given dock object:

private void dockingManager1_DockingStateChanged(object sender, DockingChangedEventArgs e)  
{  
    if (e.DockState == DockState.Hidden)  
    {  
        this.dockingManager1.Remove(e.DockObject);  
    }  

I hope this clarifies the case. Don't hesitate to contact us if you have other questions.

All the best,
Angel
the Telerik team

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