Skip to main content

DataGridView.SaveLayoutToStream(Stream) Method

Saves the grid’s layout to the specified stream.

Namespace: DevExpress.XamarinForms.DataGrid

Assembly: DevExpress.XamarinForms.Grid.dll

NuGet Package: DevExpress.XamarinForms.Grid

Declaration

public void SaveLayoutToStream(
    Stream stream
)

Parameters

Name Type Description
stream Stream

A Stream descendant to which the grid’s layout is written.

Remarks

Call the SaveLayoutToStream method to write the DataGridView‘s layout to a stream. You can then use the RestoreLayoutFromStream method to read saved settings.

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