DockingManager.LoadDockState() doesn''t load the state from MemoryStream

There is the problem with DockingManager. I have а string contating DockingState in XML, made ealier by DockingManager.SaveDockState() method. Now I want set that dockingState to my dockingManager in SerializeMode.XMLFmtStream mode. So, I write: --------------- public void SetDockingState(string xmlDockingState) { byte [] bArray = new UTF8Encoding(true).GetBytes(xmlDockingState); MemoryStream stream = new MemoryStream(); stream.Write(bArray, 0, bArray.Length); AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFmtStream, stream); this.dockingManager.LoadDockState(aser); } --------------- But this code does nothing. xmlDockingState is correct XML, because I wrote it to file and then loaded it in SerializeMode.XMLFile mode - it''s work!

2 Replies

MU Murugan Syncfusion Team July 11, 2006 06:37 PM UTC

Hi Lev, When dock state is written into a stream, the position of the stream will be at the end. When AppStateSerializer reads the position, being at end, the docking state is not loaded. After writing the stream we have set the stream position to 0 to load the dock state correctly. public void SetDockingState( string xmlDockingState ) { byte [] bArray = new UTF8Encoding(true).GetBytes(xmlDockingState); MemoryStream stream = new MemoryStream(); stream.Write(bArray, 0, bArray.Length); stream.Position = 0; AppStateSerializer aser = new AppStateSerializer(SerializeMode.XMLFmtStream, stream); this.dockingManager1.LoadDockState(aser); } I have attached a sample.Please go through that and let me know if you need more assistance. Thanks for your interest on Syncfusion products. Regards, Murugan PS

Docking_XML.zip


AD Administrator Syncfusion Team July 12, 2006 10:48 AM UTC

> stream.Position = 0; It really works :) Thanks a lot!

Loader.
Up arrow icon