panel content does not appear after loading layout

11 posts, 0 answers
  1. Kashif Imran
    Kashif Imran avatar
    29 posts
    Member since:
    Apr 2009

    Posted 27 Apr 2009 Link to this post

    I used the sample code from demos to save/load layout. It loads the layout but all the content inside panes does not show up. Do I have to do anything extra to show the content? I dont see any sample in the documentation for that.
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 28 Apr 2009 Link to this post

    Hi Kashif Imran,

    You Should put SerializationTag (attached property of the RadDocking class) on all the panes in which you have content. Please, take a look at the following blog post:  http://blogs.telerik.com/miroslavnedyalkov/posts/09-04-22/raddocking_save_load_layout.aspx.

    Regards,
    Miroslav Nedyalkov
  3. DevCraft banner
  4. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 30 Apr 2009 Link to this post

    I am adding some RadPanes dyamically through code.  How do I set the SerializationTag from within the xaml.cs?

    Example: when I create a new floating pane, how do I set the SerializationTag to the 'newPane' object?

    RadPane newPane = new RadPane();  
    newPane.Title = "Title";  
    newPane.Header = "Header";  
    newPane.Content = MyContentControl;  
    MyRadPaneGroup.AddItem(aNewPane, DockPosition.Center);  
    newPane.MakeFloatingOnly();  

    Thank you for your help.
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 05 May 2009 Link to this post

    Hello Jeremy,

    You just need to add the following line to your code:
    RadDocking.SetSerializationTag(newPane, "some tag"); 
    This is a standard way to set an attached property from the code-behind.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  6. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 11 May 2009 Link to this post

    Miroslav thank you for the help.

    Unfortunately this did not solve my issue I was hoping to have it resolve.

    When I am dynamically adding RadPanes to the Docking, Save the layout, and then Load the layout, none of the dynamically added RadPanes retains their content.  All of the other RadPanes that were not added dynamically retain their content as I was hoping. 

    Another interesting note is that once I load the layout, I can no longer dynamically add any RadPanes to the docking.

    Is there anything I am doing incorrectly?
    Thank you for your help and input.

    Here is the code I am using to dynamically create the RadPanes and add them to a RadPaneGroup:
    RadPane newPane = new RadPane();  
    newPane.Title = "New";  
    newPane.Header = "New";  
    newPane.Content = new MyUserControl();  
    RadDocking.SetSerializationTag(newPane, "NewRadPane");  
    radPaneGroup.AddItem(newPane, DockPosition.Center);  
    newPane.MakeFloatingOnly(); 
  7. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 12 May 2009 Link to this post

    Hello Jeremy,

    The code seems to be correct, but these dynamic panes and the problem that you have with them make me think that the next time you open the application, they will not be created. Unfortunately, the Docking control doesn't save the Content of the panes. It just remembers the properties of the panes, groups and split containers and the way they are arranged. It only matches the SerializationTag of the saved pane with the SerializationTag of the pane that is already created. It works for the static panes, because when your application loads, the XAML parser creates all the static panes and their contents correctly, but the dynamic panes are created by the docking control and it doesn't know what content to put in them.

    If this is your case, you can solve it by handling the ElementLoaded event of the docking control and setting the content of the newly created pane yourself. Note that it should work correctly without this, if you just reload the layout just after you have added the dynamic panes.

    About the second problem - 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 cannot add more panes - the group that you are trying to access is no more in the Docking control. To solve this, just add Serialization tag to all the groups you want to keep.

    Please, find the attached project that demonstrates both approaches.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  8. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 14 May 2009 Link to this post

    Miroslav,
    Thank you very much for your help! 

    I thought I had set my group serializationtag, however I went back and checked and sure enough there was not one.

    One more question I do have that pertains to reloading the content back to the layout when it is loaded.  Is there a way to associate metadata to the RadPanes that will be saved off with the layout?  I would like to be able to save the content Type as well as a parameter for startup.  Then when I load the RadPanes from the saved layout query the metadata to get my content Type to instantiate as well as the initialize parameter.  Is this something that is currently supported, or perhaps supported in a future release?

    Thank you again for the help!
    Jeremy
  9. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 14 May 2009 Link to this post

    Hi Jeremy,

    Unfortunately we don't have such functionality implemented, but it looks really useful and we will think about some way for including this in the future versions. 

    At this time I can suggest that you use the SerializationTag property for that. You can think about a format that will be easy to parse back when loading and that will contain the data you need. The important thing here is that the SerializationTag is:
    - a string
    - cannot contain not-escaped quotes
    - cannot contain not-escaped less than and more then signs
    These limitations are because the SerializationTag is serialized as a string attribute in XML.

    There is one more thing that you should notice if you decide to use the SerializationTag for this - it is used to identify the components and if you need to change it at runtime and load old layout XML with the old SerializationTag, the pane will be destroyed and a new pane will be created with the old SerializationTag. This should not cause any issues though.

    As for an example, you can save the name of the view and a list of key-value pairs - your named parameters, separated with comas. This should look like:
    "ViewName paramName1:paramValue1, paramName2:paramValue2, etc.".

    Hope this helps to solve the problem.


    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the newTelerik Support Portal.
    Check out the tipsfor optimizing your support resource searches.
  10. Jeremy
    Jeremy avatar
    24 posts
    Member since:
    Oct 2008

    Posted 14 May 2009 Link to this post

    Miroslav,
    Thank you for the reply and suggestion.  I am actualy doing something very similiar to this and it does work.  I am able to load the saved layout along with the content and parameters successfully.

    Thanks Again!.
    Jeremy
  11. Jaime Bula
    Jaime Bula avatar
    41 posts
    Member since:
    Apr 2009

    Posted 27 Jul 2010 Link to this post

    This should be added to the documentation. Could have saved a ton of time. I was about to set a support ticket.  

    http://www.telerik.com/help/silverlight/raddocking-features-save-load-layout.html
  12. George
    Admin
    George avatar
    1332 posts

    Posted 30 Jul 2010 Link to this post

    Hi Jaime Bula,

    Thank you for contacting us.

    Could you be more specific what information you want to be added in the online documentation? It would be very helpful if you give us more details. We will update the RadDocking help.  

    We highly appreciate your feedback since it helps us to improve our products. Please do not hesitate to contact us if you require any further information.


    Regards,
    George
    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
DevCraft banner