GridControl.SaveLayoutToStream(Stream) Method

Saves a grid's layout to the specified stream.

Namespace: DevExpress.Mobile.DataGrid

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

Declaration

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

Parameters

Name Type Description
stream Stream

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

Remarks

Important

This documentation topic describes legacy technology. We no longer develop new functionality for the GridControl and suggest that you use the new DataGridView control instead.

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