BaseView.RestoreLayoutFromStream(Stream, OptionsLayoutBase) Method
Restores the View’s layout using the specified settings which are stored in the specified stream.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v19.1.dll
Declaration
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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RestoreLayoutFromStream(Stream, OptionsLayoutBase) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.