LayoutControl.SaveLayoutToXml(String) Method
SECURITY-RELATED CONSIDERATIONS
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Saves the layout to an XML file.
Namespace: DevExpress.XtraLayout
Assembly: DevExpress.XtraLayout.v25.2.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
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);