BaseView.SaveLayoutToStream(Stream, OptionsLayoutBase) Method

Saves the View's layout using the specified settings to the specified stream.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll


public void SaveLayoutToStream(
    Stream stream,
    OptionsLayoutBase options
Public Sub SaveLayoutToStream(
    stream As Stream,
    options As OptionsLayoutBase


Name Type Description
stream Stream

A Stream descendant to which the View's layout is written.

options OptionsLayoutBase

A OptionsLayoutBase descendant specifying which options should be saved.


Use the SaveLayoutToStream method to save the specific settings of a View to a stream. The settings can then be restored via the BaseView.RestoreLayoutFromStream method.

The options parameter determines which options should be saved to the stream. For the grid control you can create an 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 saved.

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

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

The SaveLayoutToStream method overload without the options parameter saves only the options which are defined by the ColumnView.OptionsLayout property.


The Document Manager identifies its child documents by names of controls hosted within these documents. Thus, its is recommended that you set unique names for these controls. Failure to comply with this recommendation will result in an exception for certain scenarios (e.g., saving and restoring a View layout by using the SaveLayoutToStream method).


You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

See Also