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

Saving the Layout at Design Time

  • 2 minutes to read

Saving the Layout at Design Time

Grid Control enables you to save and then restore the layouts of Views to XML files at design time. For instance, at design time you can create and customize a View, add columns/bands, arrange them in a specific order, change sorting and grouping settings, etc., and then save the layout to an XML file via the Grid Designer. You will then be able to restore this layout at design time or runtime within the current or other view, and even in another application.

To store and restore layouts at design time, use the Layout Page of the Grid Designer. This allows you to load and save a layout to an XML file. It is also possible to load the layout that has been previously saved to an XML file at runtime using the BaseView.RestoreLayoutFromXml method.

When a View’s layout is saved at design time, all the settings of the View object and its columns are saved. The information that is stored is enough to replicate the current View in another empty View, so that the Views look identical. When a layout is restored at design time, all the settings that are stored in the XML file are restored. Note that settings of in-place editors of columns are not saved when the layout is saved.

At runtime, the set of options that are saved/restored using the BaseView.SaveLayoutToXml and BaseView.RestoreLayoutFromXml methods is different, by default, than the set of options that are saved/restored at design time. By default, the appearance, data-aware, behavior, customization, detail, selection and some other options are not saved/restored at runtime. To save or restore the complete set of options at runtime call the BaseView.SaveLayoutToXml or BaseView.RestoreLayoutFromXml method with the static OptionsLayoutBase.FullLayout property as the options parameter.