Skip to main content
A newer version of this page is available. .

How to: Save the layout of bars to a stream

Tip

You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

The following code demonstrates how to write and read a BarManager’s state to/from memory using the System.IO.MemoryStream class.

    System.IO.Stream stream = new System.IO.MemoryStream();
    barManager1.SaveLayoutToStream(stream);
    //set the stream position to the beginning
    stream.Seek(0, System.IO.SeekOrigin.Begin);

    //...

    barManager1.RestoreLayoutFromStream(stream);
    //set the stream position to the beginning
    stream.Seek(0, System.IO.SeekOrigin.Begin);