Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

LayoutControl.SaveLayoutToStream(Stream) Method

Saves the current layout to the specified stream.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v24.2.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