TreeList.SaveLayoutToRegistry(String) Method
Saves the control’s layout to the specified system registry path.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
path | String | A string value, specifying the system registry path to which the layout is saved. |
Remarks
Use the SaveLayoutToRegistry method to save the TreeList‘s layout to the system registry. You can restore these settings via a TreeList.RestoreLayoutFromRegistry method call.
The control’s layout is saved to the path specified by the path parameter. You are allowed to define whole and partial registry keys. For instance, if you define a partial key, “Software\MyCompany\MyTool" the full path will be as follows: “HKEY_CURRENT_USER\Software\MyCompany\MyTool". If you wish to store a layout in a different root key, you should define the entire path, for instance: “HKEY_LOCAL_MACHINE\Software\MyCompany\MyTool".
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 demonstrates how to save the layout of the Tree List control to the registry and then restore it. The TreeList.SaveLayoutToRegistry and TreeList.RestoreLayoutFromRegistry methods are used for this purpose.
string registryPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\TreeListLayout";
treeList1.SaveLayoutToRegistry(registryPath);
treeList2.DataSource = treeList1.DataSource;
treeList2.RestoreLayoutFromRegistry(registryPath);