Back to Devexpress

TreeList.SaveLayoutToXml(String) Method

windowsforms-devexpress-dot-xtratreelist-dot-treelist-dot-savelayouttoxml-x28-system-dot-string-x29.md

latest3.4 KB
Original Source

TreeList.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 a control’s layout to a specified XML file.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

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

Declaration

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

Parameters

NameTypeDescription
xmlFileString

A string value specifying the XML file name.

|

Remarks

Use the SaveLayoutToXML method to save the TreeList control’s layout to an XML file. You can restore saved settings later, via a TreeList.RestoreLayoutFromXml method call.

The Tree List options that are saved are identified by the TreeList.OptionsLayout object.

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 following sample code saves the layout of the Tree List control to an XML file and then restores it. The TreeList.SaveLayoutToXml and TreeList.RestoreLayoutFromXml methods are used for this purpose.

csharp
string fileName = "c:\\TreeListLayout.xml";
treeList1.SaveLayoutToXml(fileName);
treeList2.DataSource = treeList1.DataSource;
treeList2.RestoreLayoutFromXml(fileName);
vb
Dim FileName As String = "c:\TreeListLayout.xml"
TreeList1.SaveLayoutToXml(FileName)
TreeList2.DataSource = TreeList1.DataSource
TreeList2.RestoreLayoutFromXml(FileName)

See Also

RestoreLayoutFromXml

SaveLayoutToRegistry

SaveLayoutToStream

Save and Restore Layouts of DevExpress controls

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace