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

Panes to ignore/omit on savelayout

3 Answers 167 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Guru
Top achievements
Rank 2
Guru asked on 06 Feb 2012, 06:07 PM
I have a docking system that has a few permanent and many dynamic possible panes or documentpanes. I set the serialization tags for the ones I want to be saved with the docking layout but I cannot seem to find a sure way to keep all other dynamic added panes from saving with the layout. Basically any items oftype radpane that do not have a serialization name I want to omit from the xml layout.

I have a routine that iterates the documenthost.items and removes any that are not names with one of the known pane names I want to keep. But I notice when debugging the items only contains ones with serialization tags, and I can see that the DocumentHost.Panes has many, these are the ones I do not want to keep...

(Called before saving docking layout)
(holderMain is documentHost, panesToKeep is array of panes by name we know we want to keep with the saved layout)
for(int p = 0; p<=holderMain.Items.Count; p++)
{
    try
    {
        RadPane pane = holderMain.Items[p] as RadPane;
        if (!panesToKeep.Contains(pane.Name)) pane.RemoveFromParent();
    }
    catch { }
}


But I still see in the saved xml that it contains various raddocumentpanes that have no serialization tags.

3 Answers, 1 is accepted

Sort by
0
Boyan
Telerik team
answered on 09 Feb 2012, 09:55 AM
Hello,

There is no way to exclude the some panes from being saved out of the box with the current implementation of RadDocking. We have this feature request logged in our PITS, you can vote for it and follow its progress here.

I am not exactly understanding what is the problem which you are experiencing but will try to explain how it works. When you load the layout, all the elements that are not marked with SerializationTag property are removed and new components are created instead. That is the reason why you should mark your panes with the SerializationTag attribute. Then in order to exclude some panes from the Layout you can either manipulate the XML after saving the layout or use some of the events we have provided for Save/Load layout. The two events you can use are ElementSaving and ElementLoading where you can exclude panes according to a rule either before they are saved or before they are loaded. Another thing you can use is to remove the panes you don't want to save before actually saving the layout. For more info you can take a look at this help article.

Don't hesitate to contact us if you have other questions.


Regards,
Boyan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jesper
Top achievements
Rank 2
answered on 22 Jul 2013, 08:54 AM
Hi,
I have read your answer to this post but I can't what I exactly have to do in the ElementLoading or ElementSaving events in order to exclude a specific pane. In my case want to make sure that DocumentPanes are never saved/loaded.
0
Rosen Vladimirov
Telerik team
answered on 25 Jul 2013, 07:15 AM
Hello Jesper,

Maybe you have noticed that the PITS item is marked as resolved - we have added ExcludeFromLayoutSave attached property, which you can set to true to your RadPanes that shouldn't be serialized. For example:
<telerik:RadPane Header="Excluded Pane" telerik:RadDocking.SerializationTag="ExcludedPane" telerik:RadDocking.ExcludedFromLayoutSave="True"/>

You can check this example in our SDK, which demonstrates how to save and load your layout.

Hopefully this helps. Feel free to contact us in case you have any problems or concerns.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
Docking
Asked by
Guru
Top achievements
Rank 2
Answers by
Boyan
Telerik team
Jesper
Top achievements
Rank 2
Rosen Vladimirov
Telerik team
Share this question
or