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

Save and Restore Layout

  • 2 minutes to read

A Layout Control’s layout contains settings which determine how its visual elements behave, their size, position within the control, etc. A layout can be saved to a stream, XML file or system registry, and then applied to any other Layout Control. This allows you to customize a layout control just once, and then apply the saved settings to other layout controls in other applications.

Tip

You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

The layout can also be temporarily saved to random-access memory (RAM) using the LayoutControl.SetDefaultLayout method. It can then be restored by clicking the Reset Layout menu item in the Layout Context Menu.

There are a number of options controlling saving of and restoring layouts. These options are accessible via the LayoutControl.OptionsSerialization object.

Note

For layout items created at runtime, you need to initialize their Name properties with unique values, to allow the Layout Control’s layout to be correctly saved and restored. You also need to assign unique values to the Name properties of the controls that will be displayed within layout items.

Note

When creating localizable applications that support multiple cultures, you may encounter a situation of losing localized captions after restoring a layout from a data store. This happens if the current locale differs from the locale that had been applied when the layout was saved. To resolve the issue (to not restore item captions while restoring the layout), set the LayoutSerializationOptions.RestoreLayoutItemText option to false.

Concepts

Member Table

Task-Based Help

See Also