Back to Devexpress

LayoutControl.SaveLayoutToStream(Stream) Method

windowsforms-devexpress-dot-xtralayout-dot-layoutcontrol-dot-savelayouttostream-x28-system-dot-io-dot-stream-x29.md

latest3.1 KB
Original Source

LayoutControl.SaveLayoutToStream(Stream) Method

Saves the current layout to the specified stream.

Namespace : DevExpress.XtraLayout

Assembly : DevExpress.XtraLayout.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual void SaveLayoutToStream(
    Stream stream
)
vb
Public Overridable Sub SaveLayoutToStream(
    stream As Stream
)

Parameters

NameTypeDescription
streamStream

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.

csharp
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);
vb
Dim stream As System.IO.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

SaveLayoutToRegistry(String)

SaveLayoutToXml(String)

OptionsSerialization

Save and Restore Layouts of DevExpress controls

LayoutControl Class

LayoutControl Members

DevExpress.XtraLayout Namespace