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

Programmatic Add/Removal of RadPane along with Save/Load layout

2 Answers 151 Views
Docking
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 08 Jun 2011, 11:57 AM
We have a project where users can add/remove RadPanes to a RadDocking control, which contain controls, etc.  The users can also save their layout and then load it back when they next run the silverlight app.

I have two questions:

1)  I'm using the "Close" event on the RadDocking control to capture when the user wants to remove a RadPane from the docking control, then I iterate through the panes, find each "hidden" pane and remove it from it's parent.  I also check to see if the parent group control contains any other panes and remove it as well.

My problem is that when saving the layout, the XML string still contains things about the removed group and the split container (pane does seem to be removed though).  Is this the correct direction to remove a RadPane, or is there a better way which I'm missing? (I'm concerned this will grow and grow with unwanted XML markup and bulk down the loading process).

Sorry to make this long, but
http://www.telerik.com/community/forums/silverlight/docking/bug-docking-not-cleaning-up.aspx seems to talk about this issue beign fixed, but I'm still having the same problem with 2011 Q1 control.

2) The second question is about adding/loading panes.  Adding a RadPane is easy and I use the Spliter/Group/Pane controls for this, but when loading the XML layout, I first programmatically create each RadPane in the docking control then load the XML layout which repositions everything.  This does work, but I feel it's a bit clunky and I'm not really happy with doing it this way.  Is there a better way?  (I did think about loading the panes in a hidden state, loading the XML, then iterate through and show them too, which might be better)

Thanks so much in advance...  David

2 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 09 Jun 2011, 10:03 AM
Hello David,

 1. It would be easier to remove the panes once they are closed using the RemoveFromParent method and the Close and PreviewClose events. When you remove all the panes from a group that is auto-generated (it was generated because of user interaction) it is automatically disposed and not save to the XML.

The problem reported in the forum thread is fixed - we not delete the empty auto-generated groups. The problem was that after layout load we didn't know which were auto-generated in the previous session. This problem shouldn't happen anymore.

2. The dynamically created panes should be loaded using the ElementLoading and ElementLoaded events of the Docking control.

Hope this information helps.

All the best,
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
0
David
Top achievements
Rank 1
answered on 09 Jun 2011, 03:19 PM
Thanks for that, I decided to use the ElementLoaded event to add the contents which works well.
Tags
Docking
Asked by
David
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
David
Top achievements
Rank 1
Share this question
or