Skip to main content
A newer version of this page is available. .

NavBarControl.SaveToRegistry(String) Method

Saves the control’s layout to the specified system registry path.

Namespace: DevExpress.XtraNavBar

Assembly: DevExpress.XtraNavBar.v19.1.dll

Declaration

public virtual bool SaveToRegistry(
    string path
)

Parameters

Name Type Description
path String

A string value specifying the system registry path to which the layout is saved.

Returns

Type Description
Boolean

true if the layout was successfully saved; otherwise false.

Remarks

Use the SaveToRegistry method to save the NavBarControl‘s layout to the system registry. You can restore these settings via the NavBarControl.RestoreFromRegistry 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".

Note

To allow a layout to be correctly saved and restored, ensure that all nav bar groups and items created at runtime have their names (the Name property) specified.

Example

The following sample code demonstrates a way in which to save control layout to the registry and then restore it. The NavBarControl.SaveToRegistry and NavBarControl.RestoreFromRegistry methods are used for this purpose.

The image below displays two NavBarControl controls before and after code execution. Note that the second control is initially empty (it doesn’t contain any groups and items). Layout information of the first control is saved to the registry. The second control restores it. Note that only the layout of groups and links is saved.

SaveRestore

navBarControl1.SaveToRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
navBarControl2.RestoreFromRegistry(
  "HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\NavBarLayout");
See Also