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

How can I find the document in DocumentHost programmatically ?

7 Answers 190 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Massimiliano Sorce
Top achievements
Rank 1
Massimiliano Sorce asked on 04 Feb 2010, 03:57 PM
The RadDocking control has properties and methods for working with Tabbed Documents quickly ?
Close/Open etc... Document programmatically.
I would like to perform a LINQ query (or for/foreach) to find the document that implements a particular interface, this is possible?

Example :

private IDebugEditor GetDebugEditor() {  
    var res = from w in radDocking.Documents where w is IDebugEditor select w;  
    if (res.Count() != 0)  
        return (IDebugEditor)res.First();  
    return null;  
}

7 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 04 Feb 2010, 04:49 PM
Hello Massimiliano,

 There is no particular functionality for the DocumentPanes, but you could get all the panes and filter only the panes in the DocumentHost. Here is an example:

dock.Panes.Where(pane => pane.IsInDocumentHost)
will yield all the panes in the DocumentHost.

Hope this helps.

Sincerely yours,
Miroslav Nedyalkov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Massimiliano Sorce
Top achievements
Rank 1
answered on 05 Feb 2010, 08:23 AM
Hi Miroslav,

thanks for you help, how do I remove a pane at runtime ?

To add I used this method : (DebugEditor is a RadDocumentPane)

((DocumentHost)dock.DocumentHost).AddPane(new DebugEditor()); 

it's correct ?
0
Miroslav Nedyalkov
Telerik team
answered on 05 Feb 2010, 01:33 PM
Hello Massimiliano,

 Is this code working correctly? In my opinion the DocumentHost property is expected to of type RadSplitContainer, so it should always throw InvalidCastException. (If you added a DocumentHost control into the DocumentHost property, you shouldn't do that - the Docking control has one in its ControlTemplate and it expects a SplitContainer in this property).

You might us the following code for adding panes:

var dhContainer = dock.DocumentHost as RadSplitContainer;
var documentHost = dhContainer.Parent as DocumentHost;
documentHost.AddPane(new DebugEditor());
You could use the method of the RadPane RemoveFromParent. It removes the pane wherever it is at this time.

Hope this helps.

All the best,
Miroslav Nedyalkov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Massimiliano Sorce
Top achievements
Rank 1
answered on 05 Feb 2010, 04:53 PM
Hi Miroslav,

I tried using your code but I get this ArgumentException :

This pane cannot be removed from parent, because it doesn't have one! 

then I thought it was wrong inherit the RadPane and I tried to add a new RadPane

var dhContainer = dockSite.DocumentHost as RadSplitContainer; 
var documentHost = dhContainer.Parent as DocumentHost; 
//documentHost.AddPane(new DebugEditor()); 
documentHost.AddPane(new RadPane()); 

but has the same ArgumentException.

Thank you in advance.
0
Miroslav Nedyalkov
Telerik team
answered on 08 Feb 2010, 11:59 AM
Hi Massimiliano,

 I'm sorry, but the AddPane method of the DocumentHost is meant to be used when you need to move a pane from one place to the DocumentHost - not for adding new panes. I would suggest you to put a Name to a group in the DocumetHost and add the panes to it. Please refer to the attached example project.

Greetings,
Miroslav Nedyalkov
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Massimiliano Sorce
Top achievements
Rank 1
answered on 12 Feb 2010, 12:58 AM
Hi Miroslav,

thanks for your example, but I still have a problem :-)
I have a control that inherits from RadDocumentPane or RadPane and I have been added in the Docking when saving and loading the layout, the docking throwing an error.
Any idea to solve the problem ?

Yours sincerely,
Massimiliano

0
Miroslav Nedyalkov
Telerik team
answered on 12 Feb 2010, 09:55 AM
Hi Massimiliano,

Set the SerializationTag attached property to all the panes should resolve the problem. If it doesn't help, please provide us with a sample project that reproduces the problem - this will help us find out what the problem is and provide you an appropriate solution.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Docking
Asked by
Massimiliano Sorce
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Massimiliano Sorce
Top achievements
Rank 1
Share this question
or