Skip to main content

DataGridView.RestoreLayoutFromStream(Stream) Method

Restores the grid’s layout from the specified stream.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

#Declaration

C#
public void RestoreLayoutFromStream(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

A Stream descendant from which the grid’s settings are read.

#Remarks

Call the RestoreLayoutFromStream method to load the grid’s layout saved to a stream with the SaveLayoutToStream method. If the specified stream is empty or null, an exception is raised.

#Example

This example shows how to use the SaveLayoutToStream and RestoreLayoutFromStream methods to save the current layout of the grid to a memory stream when you click a button and restore it when you click another button.

using System.IO;
using DevExpress.XamarinForms.DataGrid;
// ...

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