This is a migrated thread and some comments may be shown as answers.

Save DockingManager content

3 Answers 176 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Filipe Rodrigues
Top achievements
Rank 1
Filipe Rodrigues asked on 21 May 2007, 08:40 AM
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.

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 21 May 2007, 03:28 PM
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
0
Filipe Rodrigues
Top achievements
Rank 1
answered on 21 May 2007, 04:31 PM
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
0
Julian Benkov
Telerik team
answered on 22 May 2007, 05:14 PM
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
Tags
Dock
Asked by
Filipe Rodrigues
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Filipe Rodrigues
Top achievements
Rank 1
Share this question
or