Skip to main content

LayoutControl.SaveLayoutToStream(Stream) Method

Saves the current layout to the specified stream.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public virtual void SaveLayoutToStream(
    Stream stream
)

Parameters

Name Type Description
stream Stream

A Stream descendant to which the current layout is written.

Remarks

Use the SaveLayoutToStream method to write the current layout to a stream. The layout can then be read using the LayoutControl.RestoreLayoutFromStream method.

See Save and Restore Layout to learn more.

Tip

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

Example

The following sample code saves the current layout to a memory stream and then restores it.

System.IO.Stream stream;
stream = new System.IO.MemoryStream();
layoutControl1.SaveLayoutToStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);

// ...
layoutControl1.RestoreLayoutFromStream(stream);
stream.Seek(0, System.IO.SeekOrigin.Begin);
See Also