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

How to save panel docking states?

I have simple application using docking manager. I want to save panels positions and docking states (eg. panels being docked together in one window). How to do it? I try to call SaveDockState to save it to xml file, but it is never created and panels' positions are reset every time.

Attachment: docking_manager_test_b238858c.zip

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team July 18, 2019 06:55 AM UTC

Hi Rafal, 
 
Thanks for using Syncfusion product. 
 
We have checked the provided sample and we have modified the sample to achieve your requirement. Please refer the below code snippet and sample for your reference. 
 
AppStateSerializer serializer = new AppStateSerializer(SerializeMode.XMLFile, "test"); 
 
public Form1() 
{ 
 
    InitializeComponent(); 
    this.dockingManager1.PersistState = true; 
    dockingManager1.HostControl = this; 
     
    this.dockingManager1.SetEnableDocking(uc1, true); 
    this.dockingManager1.SetEnableDocking(uc2, true); 
    this.dockingManager1.SetDockLabel(uc1, "control 1"); 
    this.dockingManager1.SetDockLabel(uc2, "control 2"); 
    this.dockingManager1.SetDockVisibility(uc2, true); 
    this.dockingManager1.SetDockVisibility(uc1, true); 
    this.dockingManager1.SetDockVisibility(uc2, true);        
    this.dockingManager1.LoadDockState(serializer); 
} 
 
protected override void OnClosing(CancelEventArgs e) 
{ 
    this.dockingManager1.SaveDockState(serializer); 
    serializer.PersistNow(); 
    base.OnClosing(e); 
} 
 
 
And you can refer the below documentation for your reference. 
 
 
Let us know whether this helps also if you need any further assistance on this. 
 
Regards, 
Jagadeesan 


Loader.
Live Chat Icon For mobile
Up arrow icon