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

Load Dock State from files.

Hi,
I'm using the DockManager and would like to have the ability to load a Dock layout from multiple files. For example, if a user generated layout file is not found, a default one is used. Could someone point me towards an example of this? Thanks.

4 Replies

RB Rajasekar B Syncfusion Team November 26, 2009 12:03 PM UTC

Hi,

While loading the dock state, if the file is not found you can restore docking state to the default state using the following methd:

this.dockingManager1.LoadDesignerDockState();

I have attached a sample. You can refer to it. Let me know if you have any question.

Thanks,
Rajasekar



Dockstate_b92f7614.zip


CB Chris Burke December 2, 2009 09:23 PM UTC

Thanks.
This leads me to another question. I want to be able to package up the file that stores the docking layout info I create, so that others can use my layout. Here is the snippet of code I'm using to save:

Syncfusion::Runtime::Serialization::AppStateSerializer
::InitializeSingleton
(Syncfusion::Runtime::Serialization::SerializeMode::XMLFile,
"defaultfile");
SaveDockingLayout();

Where would this file be save? Is it even possible to obtain ii and distribute via this method, or is there another way I'd have to go about saving it to do this? And if so, how?



CB Chris Burke December 2, 2009 10:33 PM UTC

I guess while I have your attention I have two other questions related to docking.

First is there a quick and easy way to tell the number of controls the docking window currently has attached to it?

And second. I'm also using the TabbedMdiManager. When closing the windows with the close button in the corner, the forms seem to get disposed. Is there a way around this, so they are just made hidden?

Thanks!


RB Rajasekar B Syncfusion Team December 4, 2009 03:45 PM UTC

Hi,

The saved xml file will be found in the bin folder of your application. The number of controls docked by the docking manager can be found by using the following line:

this.dockingManager1.ControlsArray.Count();

this will return the number of controls. To hide a form, when it is closed in tabbedmdimanager, handle its form closing event and cancel that event and use the following coding:
form.Hide();
form.MdiParent=null;

To show the form again, use the following lines of code:
form.Show();
form.MdiParent=this;

I have attached a sample. Refer to it and let me know if you have any question.

Thanks,
Rajasekar






tabmdiformclose_1b64585.zip

Loader.
Live Chat Icon For mobile
Up arrow icon