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

Controls are reversed when saving/loading a DockManager

I save out my dock manager using the following code:

private byte[] GetDockState()
{
MemoryStream ms = new MemoryStream();
AppStateSerializer appStateSer = new AppStateSerializer(SerializeMode.XMLFile, ms);
_dockMgr.SaveDockState(appStateSer);
appStateSer.PersistNow();
string stateStr = ms.ToString();
return ms.ToArray();
}


and load it back like this:

private void SetDockState(byte[] value)
{
_dockMgr.LoadDockState(new AppStateSerializer(
SerializeMode.XMLFile, new MemoryStream(value)));
}

However when I do, two of the controls are reversed. This happens every time, so if I save and load, they swap again. How can I fix this?

1 Reply

MU Murugan Syncfusion Team October 11, 2006 04:09 PM UTC

Hi Daniel,

Before going to load from MemoryStream its seeking position has to be initialized to Beginning of the stream. Please refer the attached code snippet for more details.

private byte[] GetDockState ( )
{
MemoryStream ms = new MemoryStream();
AppStateSerializer app = new AppStateSerializer(SerializeMode.XMLFile, ms);
this.dockingManager1.SaveDockState(app);
app.PersistNow();
return ms.ToArray();
}

private void SetDockState (byte[] value)
{
MemoryStream ms = new MemoryStream(value);
ms.Seek(0, SeekOrigin.Begin);
this.dockingManager1.LoadDockState(new AppStateSerializer(SerializeMode.XMLFile, ms));
}

Thanks for choosing Syncfusion products.

Best Regards,
Murugan P.S

Loader.
Live Chat Icon For mobile
Up arrow icon