Panes in DocumentHost not saved in display order

4 posts, 0 answers
  1. Mikkel
    Mikkel avatar
    2 posts
    Member since:
    Dec 2013

    Posted 18 Apr 2014 Link to this post

    I have an application where I use several RadDocumentPanes in the DocumentHost to keep various content. The users are (obviously) able to move panes around as they like. When the application closes the current layout is saved and restored automatically when the application is started again.

    When I initially open the application and no saved layout exist the panes in the DocumentHost are showed in the default order. When I save that layout the display order is preserved perfectly in the saved XML output. All is good. If I however start to move panes around within the DocumentHost or move a pane out of the DocumentHost  and back again then the saved layout will not reflect the order in which the panes are displayed. And on load they will obviously be restored in a different order.

    This can actually be reproduced easily using the Telerik WPF demo application. Perform the following operations using the "Save/Load Layout" example:

    1. Open the example, press the "Save Layout" button and inspect the saved XML in the "Layout XML" pane. Note that the order in the XML of the DocumentHost part reflects the order which the two panes ("Layout XML" and "Document 1") are shown. All is good.
    2. Move the "Panel Top 1" inside the DocumentHost and dock it at the end. Save the layout again and check the order of the XML. All is still good.
    3. Move the "Panel Right 1" inside the DocumentHost and dock it somewhere in the middle. Save the layout again. Note that the saved order no longer reflects the displayed order.
    4. Press the "Load Layout" button and note that the order in the DocumentHost is now switched around.

    This problem does as far as I have been able to detect only affect the DocumentHost and not the other pane groups.

    The problem is obviously highly annoying and I would like some pointers as to how I can either solve or work around it.
  2. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 22 Apr 2014 Link to this post

    Hello Mikkel,

    We are already aware of the explained issue and it has been logged in our Feedback portal. You can easily track its status on the following link:
    http://feedback.telerik.com/Project/143/Feedback/Details/113648-after-reordering-radpanes-in-a-radpanegroup-the-enumeratepanes-method-doesnt-r

    However I cannot suggest you any work around at the moment. What you can do is to follow the item and get notified once the its status is updated.

    I'm sorry for any inconvenience caused. If you have any other question, don't hesitate to contact us.

    Regards,
    Kalin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Mikkel
    Mikkel avatar
    2 posts
    Member since:
    Dec 2013

    Posted 22 Apr 2014 in reply to Kalin Link to this post

    OK, at least thanks for the fast answer. In case anyone else suffers from this I managed to implement a workaround using XDocument and Linq. The "Items" collection of the DocumentHosts RadPaneGroup contains the correct order whereas the EnumeratePanes() method apparently returns the wrong order. You can then fix the problem as follows:
    1. Read the RadPaneGroup.Items collection and extract the SerializationTag for each pane to a list. This list contains the correct order which you want to save.
    2. Save the docking layout using the SaveLayout() method on the main docking control and extract the XML as a string as you normally would. But do not save it to a file just yet.
    3. Create an XML document using XDocument and parse the XML string.
    4. Extract a list of all elements of type "RadDocumentPane" using the Descendants() method and sort these in the right order using the ordered list you created in step 1.
    5. Locate the RadPaneGroup for the DocumentHost and delete all elements of the child element "Items".
    6. Add the sorted elements from step 4 back into the RadPaneGroup.Items container.
    7. Save the result to a textfile.
  5. Kalin
    Admin
    Kalin avatar
    1208 posts

    Posted 22 Apr 2014 Link to this post

    Hi Mikkel,

    Thank you for sharing the workaround - I have added it to the description of the item in the Feedback portal.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top