Skip to main content

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.v23.2.dll

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

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.

See Also