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

BaseView.SaveLayoutToXml(String, OptionsLayoutBase) Method

Saves the View’s layout using the specified settings to the specified XML file.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v19.1.dll

Declaration

public void SaveLayoutToXml(
    string xmlFile,
    OptionsLayoutBase options
)

Parameters

Name Type Description
xmlFile String

A string value specifying the path to the file where the View’s layout settings should be stored. If an empty string is specified, an exception is raised.

options OptionsLayoutBase

A OptionsLayoutBase descendant specifying which options should be saved.

Remarks

Use the SaveLayoutToXml method to save specific settings of a View to a file in XML format. The settings can then be restored via the BaseView.RestoreLayoutFromXml method.

The options parameter determines which options should be saved to the file. 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 affected.

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

The SaveLayoutToXml 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 SaveLayoutToXml 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 snippet (auto-collected from DevExpress Examples) contains a reference to the SaveLayoutToXml(String, 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