Back to Devexpress

LayoutControl.SaveLayoutToXml(String) Method

windowsforms-devexpress-dot-xtralayout-dot-layoutcontrol-dot-savelayouttoxml-x28-system-dot-string-x29.md

latest3.3 KB
Original Source

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

csharp
public virtual void SaveLayoutToXml(
    string xmlFile
)
vb
Public Overridable Sub SaveLayoutToXml(
    xmlFile As String
)

Parameters

NameTypeDescription
xmlFileString

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.

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

See Also

SaveLayoutToRegistry(String)

SaveLayoutToStream(Stream)

OptionsSerialization

Save and Restore Layouts of DevExpress controls

LayoutControl Class

LayoutControl Members

DevExpress.XtraLayout Namespace