Skip to main content

LayoutControl.SaveLayoutToXml(String) Method

Saves the layout to an XML file.

Namespace: DevExpress.XtraLayout

Assembly: DevExpress.XtraLayout.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public virtual void SaveLayoutToXml(
    string xmlFile
)

Parameters

Name Type Description
xmlFile String

A String value that specifies the path to the file where the layout should be stored. If an empty string is specified, an exception is raised.

Remarks

Use the SaveLayoutToXml method to save the current layout to a file in XML format at runtime. The saved settings can then be restored using the LayoutControl.RestoreLayoutFromXml method.

See Save and Restore Layout to learn more.

Tip

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

Example

The code below demonstrates how the layout can be saved to and then restored from an XML file.

string f = "c:\\Layout.xml";
// Save the layout to an XML file.
layoutControl1.SaveLayoutToXml(f);
// ...
// Restore a previously saved layout.
layoutControl1.RestoreLayoutFromXml(f);

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