Save DockingManager content

4 posts, 0 answers
  1. Filipe Rodrigues
    Filipe Rodrigues avatar
    21 posts
    Member since:
    Oct 2006

    Posted 21 May 2007 Link to this post

    Hi,
    I need to save/load the structure and dockpanels of my dockingmanager without using savexml and readxml.

    I need some code like this:

    save panels:
    For Each d As DockPanel In DockingManager1.DockingSites(0).ManagedDockables
      comando.Parameters.Clear()
      comando.Parameters.Add(New SqlClient.SqlParameter("@Codigo", i))
      comando.Parameters.Add(New SqlClient.SqlParameter("@CodigoVista", vista))
      comando.Parameters.Add(New SqlClient.SqlParameter("@Indicador", i))
      comando.Parameters.Add(New SqlClient.SqlParameter("@DockPosition", d.DockPosition))
      comando.Parameters.Add(New SqlClient.SqlParameter("@Altura", d.Size.Height))
      comando.Parameters.Add(New SqlClient.SqlParameter("@Largura", d.Size.Width))

      comando.CommandText = "INSERT INTO TbPaineis (Codigo,CodigoVista,Indicador,DockPosition,Altura,Largura) VALUES(@Codigo,@CodigoVista,@Indicador,@DockPosition,@Altura,@Largura)"
      If sqlConn.State <> ConnectionState.Open Then
        sqlConn.Open()
      End If
      comando.ExecuteNonQuery()

      i += 1
    Next


    load panels:

    For Each d As Object In DockingManager1.DockingSites(0).ManagedDockables
      DockingManager1.DockingSites(0).Remove(d)
    Next

    For Each dr As DataRow In dsVistas.Tables(0).Rows
      Dim dock As New DockPanel
      dock.Tag = dr("Codigo")
      dock.Text = dr("Indicador")
      DockingManager1.SuspendLayout()
      dock.Size = New Size(dr("Largura"), dr("Altura"))
      DockingManager1.ResumeLayout()
      DockingManager1.SetDock(dock, dr("DockPosition"))
    Next

    I tried this code but the structure loaded is different from the saved one.
    What is missing?
    Thanks in advance.

  2. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 21 May 2007 Link to this post

    Hello Filipe,

    The current DockingManager load/save functionality uses tree layout structure, which is important for restoring the same layout. Your example code is correct, but it does not cover the dock tree layout.

    In the SP2 release we will include a new property for the DockingManager - DockLayout - which will be a string representation of the dock layout's xml, and you may use it in your serialization/deserialization database approach.

    We are sorry if the current implementation causes you some inconvenience. Let us know if we can be of further assistance.

     
    Greetings,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Filipe Rodrigues
    Filipe Rodrigues avatar
    21 posts
    Member since:
    Oct 2006

    Posted 21 May 2007 Link to this post

    Hi, I opened a saved xml of a raddockingmanager and I recognize de tree structure...but how is the structure restored from xmlfile?

    The tree structure could be stored in 2 properties of the raddockingmanager for instance property TreeLeft and property TreeRight and each of it have also TreeLeft and TreeRight properties...ans so one...and if any of that have the property isLeaf set to true, than it stores an object of type dockpanel (with dockposition, size, text, tag, etc)...I think these feature could be very usefull.

    The xml saved with saveXml doesn't saves the dockpanel's tag value...this feature is also important to restore the content of dockpanels afer readXml.

    Thanks
  5. Julian Benkov
    Admin
    Julian Benkov avatar
    1135 posts

    Posted 22 May 2007 Link to this post

    Hi Filipe,

    Internally the RadDock engine uses binary tree and a serialization process, which is very close to your ideas and suggestions. Our idea is to add a DockLayout property and keep the RadDock API simple . Nevertheless, thank you for your feedback and good suggestions - your points have been updated.
     

    Regards,
    Julian Benkov
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top