Skip to main content
A newer version of this page is available. .

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.v19.1.dll

Declaration

public void SaveLayoutToStream(
    Stream stream,
    OptionsLayoutBase options
)

Parameters

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.

Remarks

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.

Important

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).

Tip

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

The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveLayoutToStream(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.

See Also