Need Ideas for Implementing SaveLayout Scheme

4 posts, 0 answers
  1. KO
    KO avatar
    16 posts
    Member since:
    Apr 2010

    Posted 30 Apr 2010 Link to this post

    Hello:

    I love the Save/Restore feature but my editable documents inside the DocumentHost absolutely cannot be persisted.

    I added SerializationTags to all of the permanent Panes that I want to persist. I was hoping panes without tags would be ignored, but empty useless panes are restored inside the DocumentHost area. So I parsed the XML output from SaveLayout and removed the DocumentHost element. That almost works, but when I call LoadLayout, now all Panes inside the DocumentHost disappear!

    What I have done is implemented a toolbar with 2 functions: 1) Save Layout and 2) Restore Last Saved Layout. So the Save and the Load can occur at any time. If I perform a Save Layout on Monday, then I am editing different documents on Friday, I certainly don't want Monday's documents restored when I click Restore Last...

    Aside from implementing my own Save/Restore logic, do you have any ideas for ignoring the DocumentHost panes?

    Thank you!

    KO
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 05 May 2010 Link to this post

    Hi Kelly,

     This sounds like custom application logic and is slightly different from the generic one - to save/load everything. You are right that we might not save the pane that don't have serialization tag, but at this time, the save layout engine saves everything.

    What I could suggest you is after loading the layout to example all the panes, hosted in the DocumentHost SplitContainer and to remove the old ones.

    Another approach could be to parse the XML and find the DocumentHost element. In it you should find a SplitContainer and a PaneGroup in it. Its panes are the panes, hosted in the DocumentHost. You could once again examine them end remove the panes, that are not needed. I wouldn't recommend you this approach as we could change the format of the XML in future.

    Hope this 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.
  3. DevCraft banner
  4. KO
    KO avatar
    16 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2010 Link to this post

    I'm still trying to get this working, with no luck. I thought about using custom logic for saving the layout, but decided against it - it is a huge problem that would take a lot of time I don't have, and your SaveLayout logic is perfectly good already if only I could make it work. The problem I am having is this:

    I do a SaveLayout and write the xml output to local storage. I don't modify it at all, just write it to disk. Upon restarting the app, I do a LoadLayout (again without modifying the xml) to restore the layout. Everything looks good. But when I try to add a RadDocumentPane to the DocumentHost, the pane just disappears. The Items.Count property of the RadPaneGroup inside the DocumentHost is incremented, everything looks like it works, no error is generated, but the newly added pane does not appear.

    If I delete the on-disk and don't try to use LoadLayout, the panes are added and work just as you would expect. By the way, if I add several panes to the DocumentHost RadPaneGroup, then do another SaveLayout, those panes are not present in the output! I have no idea where they are going.

    Here is the xaml for the DocumentHost:

    <telerikDock:RadDocking.DocumentHost> 
        <telerikDock:RadSplitContainer x:Name="DocHostContainer">  
            <telerikDock:RadPaneGroup x:Name="DocHostPaneGroup">  
            </telerikDock:RadPaneGroup> 
        </telerikDock:RadSplitContainer> 
    </telerikDock:RadDocking.DocumentHost> 
     

    Here is how I add panes:

    RadDocumentPane pane;  
     
    pane = new RadDocumentPane();  
    pane.Content = editor; // Editor is a UserControl-based class.  
    pane.Tag = tag;  
    pane.ContextMenuTemplate = null;  
    DocHostPaneGroup.Items.Add(pane);  // Also tried AddItem(pane, DockPosition.Center)
     

    Here is the output of SaveLayout, and I have confirmed that it is correctly saved and identical when passed to LoadLayout:

    <?xml version="1.0" encoding="utf-8"?>  
    <RadDocking> 
        <DocumentHost> 
            <RadSplitContainer> 
                <Items> 
                    <RadPaneGroup SelectedIndex="-1">  
                        <Items/> 
                    </RadPaneGroup> 
                </Items> 
            </RadSplitContainer> 
        </DocumentHost> 
        <SplitContainers> 
            <RadSplitContainer Dock="DockedLeft" Width="375">  
                <Items> 
                    <RadPaneGroup SelectedIndex="0">  
                        <Items> 
                            <RadPane SerializationTag="AAPane" IsHidden="False" IsDockable="True" Title="AA" Header="AA" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="BBPane" IsHidden="True" IsDockable="True" Title="BB" Header="BB" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="CCPane" IsHidden="True" IsDockable="True" Title="CC" Header="CC" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="DDPane" IsHidden="True" IsDockable="True" Title="DD" Header="DD" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="EEPane" IsHidden="True" IsDockable="True" Title="EE" Header="EE" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="FFPane" IsHidden="False" IsDockable="True" Title="FF" Header="FF" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="GGPane" IsHidden="False" IsDockable="True" Title="GG" Header="GG" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="HHPane" IsHidden="True" IsDockable="True" Title="HH" Header="HH" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="IIPane" IsHidden="False" IsDockable="True" Title="II" Header="II" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="JJPane" IsHidden="True" IsDockable="True" Title="JJ" Header="JJ" CanDockInDocumentHost="False"/>  
                            <RadPane SerializationTag="KKPane" IsHidden="True" IsDockable="True" Title="KK" Header="KK" CanDockInDocumentHost="False"/>  
                        </Items> 
                    </RadPaneGroup> 
                </Items> 
            </RadSplitContainer> 
            <RadSplitContainer Dock="DockedRight" Width="254">  
                <Items> 
                    <RadPaneGroup SelectedIndex="0">  
                        <Items> 
                            <RadPane SerializationTag="Properties" IsDockable="True" Title="LL" Header="LL" CanUserClose="False" CanDockInDocumentHost="False"/>  
                        </Items> 
                    </RadPaneGroup> 
                </Items> 
            </RadSplitContainer> 
            <RadSplitContainer Dock="DockedBottom" Height="180">  
                <Items> 
                    <RadPaneGroup SelectedIndex="0">  
                        <Items> 
                            <RadPane SerializationTag="LLPane" IsDockable="True" Title="LL" Header="LL"/>  
                            <RadPane SerializationTag="MMPane" IsDockable="True" Title="MM" Header="MM"/>  
                        </Items> 
                    </RadPaneGroup> 
                </Items> 
            </RadSplitContainer> 
        </SplitContainers> 
    </RadDocking> 
     

    Do you see anything wrong with the SaveLayout output that would prevent me from adding Panes to the DocumentHost when the layout is reloaded?

    Thank you,

    KO
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 15 Jun 2010 Link to this post

    Hi Kelly,

    As I can see in your code you are not setting SerializationTag to your group and split container that have x:Name set. That means that after loading the layout they will be recreated and the names will not reference to the displayed group and split container but to some other ones. What I could suggest you is to set SerializationTag to all the groups and split containers with x:Name set.

    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.
Back to Top