Back to Devexpress

TreeList.RestoreLayoutFromXml(String) Method

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

latest3.6 KB
Original Source

TreeList.RestoreLayoutFromXml(String) Method

SECURITY-RELATED CONSIDERATIONS

Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.

Loads a control’s layout from the 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 RestoreLayoutFromXml(
    string xmlFile
)
vb
Public Overridable Sub RestoreLayoutFromXml(
    xmlFile As String
)

Parameters

NameTypeDescription
xmlFileString

A string value specifying the XML file from which control settings are read.

|

Remarks

Use the RestoreLayoutFromXML method to load the TreeList control’s layout from an XML file. Control settings must have previously been written to this file via the TreeList.SaveLayoutToXml method call.

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

Note

When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the TreeList.ForceInitialize method prior to the layout restoration. See this method to learn more.

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

SaveLayoutToXml

RestoreLayoutFromRegistry

RestoreLayoutFromStream

Save and Restore Layouts of DevExpress controls

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace