Back to Devexpress

LayoutControl.SaveLayoutToRegistry(String) Method

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

latest3.5 KB
Original Source

LayoutControl.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 current layout to the specified system registry path.

Namespace : DevExpress.XtraLayout

Assembly : DevExpress.XtraLayout.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
public virtual void SaveLayoutToRegistry(
    string path
)
vb
Public Overridable Sub SaveLayoutToRegistry(
    path As String
)

Parameters

NameTypeDescription
pathString

A String value that specifies the system registry path to which to save the layout.

|

Remarks

The path parameter can be one of the following strings:

  • A full registry path. For example, “HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject".
  • A partial registry path. For example, “Software\MyCompany\MyProject". In this case, the full path is “HKEY_CURRENT_USER\Software\MyCompany\MyProject".

Use the LayoutControl.RestoreLayoutFromRegistry method to restore a saved layout.

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 following sample code can be used to write and read the layout to/from the system registry. The full path for the layout will be: HKEY_CURRENT_USER\DevExpress\Layout Control\Layouts.

csharp
string regKey = "DevExpress\\Layout Control\\Layouts";
layoutControl1.SaveLayoutToRegistry(regKey);

// ...

layoutControl1.RestoreLayoutFromRegistry(regKey);
vb
Dim regKey As String = "DevExpress\Layout Control\Layouts"
LayoutControl1.SaveLayoutToRegistry(regKey)

' ...

LayoutControl1.RestoreLayoutFromRegistry(regKey)

See Also

SaveLayoutToStream(Stream)

SaveLayoutToXml(String)

OptionsSerialization

Save and Restore Layouts of DevExpress controls

LayoutControl Class

LayoutControl Members

DevExpress.XtraLayout Namespace