Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

VGridControlBase.RestoreLayoutFromStream(Stream) Method

SECURITY NOTE

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Restores a vertical grid’s layout from the specified stream.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid

#Declaration

public virtual void RestoreLayoutFromStream(
    Stream stream
)

#Parameters

Name Type Description
stream Stream

A Stream descendant from which the vertical grid’s settings are read. If null (Nothing in Visual Basic), an exception is raised.

#Remarks

Use the RestoreLayoutFromStream method to load the vertical grid’s layout from the stream to which the layout was saved via the VGridControlBase.SaveLayoutToStream method.

#Example

The following sample code saves the vertical grid’s layout to a file stream and then applies it to another vertical grid. The VGridControlBase.SaveLayoutToStream and VGridControlBase.RestoreLayoutFromStream methods are used for this purpose.

using System.IO;

string fileName = "C:\\XtraVerticalGridLayout";
FileStream outFile = new FileStream(fileName, FileMode.Create);
vGridControl1.SaveLayoutToStream(outFile);
outFile.Close();
vGridControl2.DataSource = vGridControl1.DataSource;
FileStream inFile = new FileStream(fileName, FileMode.Open);
vGridControl2.RestoreLayoutFromStream(inFile);
inFile.Close();
See Also