The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridControl.RestoreLayoutFromStream(Stream) Method

Restores a grid's layout from the specified stream.

Namespace: DevExpress.Mobile.DataGrid

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

Declaration

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

Parameters

Name Type Description
stream Stream

A Stream descendant from which grid settings are read.

Remarks

Use the RestoreLayoutFromStream method to load the grid's layout from the stream to which the layout was saved via the GridControl.SaveLayoutToStream method. If the specified stream is empty or null, an exception is raised.

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