Back to Devexpress

DockManager.SaveLayoutToRegistry(String) Method

windowsforms-devexpress-dot-xtrabars-dot-docking-dot-dockmanager-dot-savelayouttoregistry-x28-system-dot-string-x29.md

latest3.8 KB
Original Source

DockManager.SaveLayoutToRegistry(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 of dock panels to the specified system registry path.

Namespace : DevExpress.XtraBars.Docking

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual bool SaveLayoutToRegistry(
    string path
)
vb
Public Overridable Function SaveLayoutToRegistry(
    path As String
) As Boolean

Parameters

NameTypeDescription
pathString

The system registry path to save the dock panels’ layout to.

|

Returns

TypeDescription
Boolean

true if the layout of dock panels has been saved to the specified system registry path; otherwise, false.

|

Remarks

The SaveLayoutToRegistry method saves all the dock panels within the dock manager, their positions, dock styles etc. Appearance settings are not saved by this method.

The path parameter contains the registry key. 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 another root key, you should define the entire path, for instance: “HKEY_LOCAL_MACHINE\Software\MyCompany\MyTool".

For more information, see Saving and Restoring the Layout of Dock Panels

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 code can be used to write and read a docking layout to and from the system registry. The full path to the docking layout will be: HKEY_CURRENT_USER\DevExpress\XtraBars\DockStates\MainState.

csharp
string regKey = "DevExpress\\XtraBars\\DockStates\\MainState";
dockManager1.SaveLayoutToRegistry(regKey);

// ...

dockManager1.RestoreLayoutFromRegistry(regKey);
vb
Dim regKey As String = "DevExpress\XtraBars\DockStates\MainState"
DockManager1.SaveLayoutToRegistry(regKey)

'...

DockManager1.RestoreLayoutFromRegistry(regKey)

See Also

SaveLayoutToStream(Stream)

SaveLayoutToXml(String)

Save and Restore Layouts of DevExpress controls

DockManager Class

DockManager Members

DevExpress.XtraBars.Docking Namespace