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
Parameters
Name | Type | Description |
---|---|---|
stream | Stream | A Stream descendant from which grid settings are read. |
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 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.
Example
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);
}