Save layout on PaneStateChanged

4 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    8 posts
    Member since:
    Dec 2010

    Posted 16 Nov 2012 Link to this post

    Hi,

    I am trying to implement a feature for load/save named docking layouts like you have in Team Pulse demo for grids.

    1. I have a dropdown with the list of available layouts like "default", "view 1", "view 2", "custom".
    2. Initially I save default layout.
    3. I subscribe to docking PaneStateChanged and all panes SizeChanged and create/modify "custom" layout. 
    4. You can rename current "custom" layout for later usage.

    The issue I found is that when I save layout in PaneStateChanged, affected pane gets into layout xml only if it's in floating state. If I dock a pane in some pane group, group.EnumeratePanes() doesn't return my pane. That's why it doesn't get into layout xml.

    This is a bug or by design? 

    Please advise how I can get it working.

    PS. I found a post where you suggested using LayoutUpdated event but I don't think this is good idea. Any mouse move causes layout updates.
  2. George
    Admin
    George avatar
    1332 posts

    Posted 21 Nov 2012 Link to this post

    Hi Dmitry,

    Please, note that when closing a pane, the PaneStateChanged won't be fired. In this case I would suggest handling the RadDocking.Close event. The PaneStateChanged event will be fire when a pane is pinned, unpinned and floated and docked.

    We tested the given scenario and we truly found a bug that the docking layout is not saved correctly on PaneStateChanged when a floating pane is docked into a group. We logged it in our PITS and you could vote for it and track its progress here - http://www.telerik.com/support/pits.aspx#/public/silverlight/13531

    I would suggest saving the Docking layout on a closing the application, for example. The PaneStateChanged is not the best point for saving, because the docking will not save the correct position of the ToolWindows (when a ToolWindow is moved, the PaneStateChanged won't be fired).

    Greetings,
    George
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
  4. Dmitry
    Dmitry avatar
    8 posts
    Member since:
    Dec 2010

    Posted 21 Nov 2012 Link to this post

    Thank you, George.

    I've found some kind of workaround in my use case. I use PaneStateChanged and SizeChanged event just to know than something has changed in layout. Actual layout save is triggered by a user's action (button click). Now all necessary info about docking is present.

    Btw, I'd suggest to think on a feature like "smart" restore layout or enable points for extension. We use PRISM with docking, regions are defined on PaneGroups. Docking can have different number of active views (panes). Once the layout is saved, only loaded panes are presented in layout xml. While restoring, I can have different number of panes in docking, less or more. With default implementation this gives errors or loses panes absent in layout xml. But it's possible to have it always working. You can restore panes in containers by checking serialization tag or something , if a pane is missing in layout xml

    Currently this is possible only via layout xml modification and dynamic panes manipulation.

  5. Vladi
    Admin
    Vladi avatar
    744 posts

    Posted 26 Nov 2012 Link to this post

    Hi Dmitry,

    Thank you for your feedback.

    We are constantly trying to improve RadDocking control and may consider using some of your suggestions for the save layout feature.

    All the best,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top