Back to Devexpress

Save and Restore Layout

windowsforms-116520-controls-and-libraries-navigation-controls-navigation-bar-save-and-restore-layout.md

latest3.7 KB
Original Source

Save and Restore Layout

  • Feb 27, 2026
  • 2 minutes to read

You can save the NavBar control’s layout into a number of storage medias and restore it later. This allows you to:

  • provide layout persistence between application runs;
  • automatically switch between the predefined layouts;
  • allow end-users to load different layouts according to their needs;
  • share layouts between different controls in one or different applications, etc.

Refer to this article to learn how to save and restore the control’s layout in code. At design-time, you can utilize the “Layout” tab of the Navigation Bar Designer.

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.

Important

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

API

MemberDescription
NavBarControl.SaveToRegistrySaves the control’s layout to the specified system registry path.
NavBarControl.SaveToStreamSaves the control’s layout to a stream.
NavBarControl.SaveToXmlSaves a control’s layout to a specified XML file.
NavBarControl.SaveToJsonSaves the control’s layout to a JSON object.
NavBarControl.RestoreFromRegistryRestores the control layout stored at a specified system registry path.
NavBarControl.RestoreFromStreamLoads a control’s layout from a stream.
NavBarControl.RestoreFromXmlLoads a control’s layout from a specified XML file.
NavBarControl.RestoreFromJsonLoads the NavBar’s layout from a file in JSON format.
NavBarControl.LayoutVersionGets or sets the version of the control’s layout.
NavBarControl.LayoutUpgradeOccurs after a layout whose version doesn’t match the current layout version has been loaded from a stream, xml file or system registry.

Examples