BaseView.RestoreLayoutFromRegistry(String) Method
SECURITY NOTE
Deserializing layout settings from untrusted resources may create security issues. Review the following help topic for additional information: Safe Deserialization.
Restores a View’s layout stored at the specified system registry path.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Grid, DevExpress.Win.Navigation
Declaration
Parameters
Name | Type | Description |
---|---|---|
path | String | A string value specifying the system registry path. If the specified path doesn’t exist, calling this method has no effect. |
Remarks
Use the RestoreLayoutFromRegistry method to restore the View’s layout written to the system registry by the BaseView.SaveLayoutToRegistry method. You can define whole and partial registry keys as this method’s parameter. For example, if you define “Software\Company", the full path will be as follows: “HKEY_CURRENT_USER\Software\Company". If you wish to store a layout in another root key, you should define the entire path such as “HKEY_LOCAL_MACHINE\Software\Company".
The ColumnView.OptionsLayout property controls which settings should be restored from the registry.
Note
When restoring a layout during a form load (for instance, in your Form.Load event handler), you may need to call the GridControl.ForceInitialize method prior to the layout restoration. See this method to learn more.
Example
The following example saves the layout of the GridControl.MainView to the system registry and then restores it. The full path for the layout in the registry will be: HKEY_CURRENT_USER\DevExpress\XtraGrid\Layouts\MainLayout
string regKey = "DevExpress\\XtraGrid\\Layouts\\MainLayout";
gridControl1.MainView.SaveLayoutToRegistry(regKey);
//...
gridControl1.MainView.RestoreLayoutFromRegistry(regKey);