GridControl.SaveLayoutToStream(Stream) Method

Saves a grid's layout to the specified stream.

Namespace: DevExpress.Mobile.DataGrid

Assembly: DevExpress.Mobile.Grid.v18.1.dll

Declaration

public void SaveLayoutToStream(
    Stream stream
)
Public Sub SaveLayoutToStream(
    stream As Stream
)

Parameters

Type Name Description
Stream stream

A Stream descendant to which a control's layout is written.

Use the SaveLayoutToStream method to write a GridControl's layout to a stream. You can then read saved settings using the GridControl.RestoreLayoutFromStream method.

Examples

The following sample code shows how to save the current layout of the grid to a memory stream on a button click and restore it on another button click. The GridControl.SaveLayoutToStream and GridControl.RestoreLayoutFromStream methods are used.

using System.IO;
// ...

MemoryStream layoutStream;

void SaveButton_Click(object sender, EventArgs e) {
    // Save the grid's layout.
    layoutStream = new MemoryStream();
    grid.SaveLayoutToStream(layoutStream);
}

void LoadButton_Click(object sender, EventArgs e) {
    // Restore the previously saved layout.
    layoutStream.Position = 0;
    grid.RestoreLayoutFromStream(layoutStream);
}

See Also