We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

reconstructing dock state through code without serialization

Hi,
I am trying to save the layout by myself, along with some other information, and recreate the same layout later, on different instance/invocation. 
I dont want to use serialization provided by syncfusion and trying to dock controls as they were at the time of save using code.
I tried different options and couldnt restore to the state which i tried to save.

Do you have any suggestions on how to do it? Or Is it not possible to do it through code?
I have attached a sample application to show my issue.

The application:
It has 2 panels from designer and another one created through code. Panels can be created through different menu options.
On startup it will have Panel1 docked to the left end and Panel2 to the right end. Panel3 will be tabbed to Panel2 through code.
New dockpanel menu will create new panels docked to the form.
New Tabpanel will create new panel and dock to visible panel created through NewdockPanel menu.
Layout->save will save the properties of the panels.
Layout->load will load the saved layout and try to recreate the layout using method1
Layout->load2 will load the saved layout and try to recreate the layout using method2

Issue:
Modified panels to have view as shown in attached image, View1 saved. Saved and tried to load it and couldn't reproduce initial view.
Tried to do the same again with a layout as in View 2 saved. In this case also initial layout couldn't be retrieved.
The image shows initial layout, modified layout and the resultant layout obtained.

Method 1:
Docked non-tabbed controls first and then tabbed controls.

Method 2:
In addition to steps in method 1, tried to change the location, size of controls and adjust the layout.

Note:
Attached dockwindow_position.zip and screen shots.zip

Regards,
VS



Attachment: screen_shots_1310462b.zip

4 Replies

VS vs June 18, 2015 03:16 PM UTC

Attached dockwindow_position.zip again.

Attachment: dockwindow_position_6c413259.zip


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team June 21, 2015 10:13 AM UTC

Hi VS,

Thank you for using Syncfusion products.

In DockingManager, serialization and deserialization is a depth process, as multiple layout functionality has been handled in Source level. Hence it is not possible to handle all levels of Serialization and De-Serialization in sample level.
 
And this reported requirement can be achieved by using LoadDockState, SaveDockState and GetEnabledDocking functions in Docking Manager. Please make use of below code snippets for your reference.

Code snippet [C#]:


      private void dockingManager1_NewDockStateEndLoad(object sender, System.EventArgs e)

              {

            // To find whether particular control is Docking window

            if (!this.dockingManager1.GetEnableDocking(this.panel3))

            {

                panel3.Name = "panel3";

                //dockingManager1.DockControl(panel3, this, Syncfusion.Windows.Forms.Tools.DockingStyle.Bottom, 200);

                dockingManager1.DockControl(panel3, panel2, Syncfusion.Windows.Forms.Tools.DockingStyle.Tabbed, 0, true);

                dockingManager1.SetDockLabel(panel3, "panel3");

            }
              }


We have also modified your sample, video for your reference and it can be downloaded for below location.

Sample Location: http://www.syncfusion.com/downloads/support/forum/119425/ze/DockingWindow_Modified-1997132472
Video Location: http://www.syncfusion.com/downloads/support/forum/119425/ze/DockingManagerVideo-2112122372

Note: 
In the shared sample project, Panel3 instance has been initialized in “NewDockStateEndLoad” event, which will be raised once Docking manager layout and Serialization/De-Serialization process is applied. Hence, NewDockStateEndLoad will be raised, once Serialization and De-Serialization is applied and new Panel3 instance is set as Docked control. So we have declared it as global instance, to avoid this case.
 
Please look into the shared sample, video and kindly let us know if it helps. If not, please provide us more details about your requirement. That will be helpful for us to analyze and provide you the prompt solution as earlier as possible.

Please let us know if you need any further assistance,

Regards,
Ashwini


VS vs June 22, 2015 10:10 AM UTC

Hi Ashwini,

Thanks for the update.

From the response I infer that 
   it is not possible to recreate the exact layout explicitly using code. 
   the way to have exact layout recreated is to use serialization provided by syncfusion through load/save dockstate.
   
Please correct if I am wrong.

Regards,
VS


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team June 23, 2015 05:08 AM UTC

Hi VS,

Thank you for your update.

Yes. In Docking manager, Serialization and De-Serialization process has been performed by using AppStateSerializer. With that, information which are to be persisted can be stored either in XML or Binary file format and can be retrieved on demand.

As many levels of docking state is needed to be maintained and for that certain order of docking layout needs to be followed, it will be difficult to handle all this case in sample level. Hence we suggest you to use in built Serialization and De-Serialization support.

Please let us know if you need any further assistance,

Regards,
Ashwini

Loader.
Live Chat Icon For mobile
Up arrow icon