Skip to main content

BaseView.RestoreLayoutFromStream(Stream, OptionsLayoutBase) Method

SECURITY NOTE

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

Restores the View’s layout using the specified settings which are stored in the specified stream.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v23.2.dll

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

Declaration

public void RestoreLayoutFromStream(
    Stream stream,
    OptionsLayoutBase options
)

Parameters

Name Type Description
stream Stream

A Stream descendant containing the layout settings.

options OptionsLayoutBase

A OptionsLayoutBase descendant specifying which options should be restored.

Remarks

Use the RestoreLayoutFromStream method to restore a layout written to a stream by the BaseView.SaveLayoutToStream method. If the specified stream is empty or null (Nothing in Visual Basic), an exception is raised.

The options parameter determines which options should be restored from the stream. For the grid control you can create a OptionsLayoutGrid object, customize it as required and then pass it as the options parameter. Only the options that are enabled in this object will be restored

Specific options which are disabled in the options parameter are not affected.

To restore all the options pass null or the static OptionsLayoutBase.FullLayout property as the options parameter.

The RestoreLayoutFromStream overload without the options parameter restores only the options which are specified by the ColumnView.OptionsLayout property.

Note

When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the GridControl.ForceInitialize method prior to the layout restoration. See this method to learn more.

See Also