VGridControlBase.SaveLayoutToRegistry(String) Method
Saves a vertical grid’s layout to a system registry path.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.1.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
Declaration
Parameters
Name | Type | Description |
---|---|---|
path | String | A string value which specifies the system registry path to which the layout is saved. |
Remarks
Use the SaveLayoutToRegistry method to save the grid’s layout to the system registry. You can restore these settings using the VGridControlBase.RestoreLayoutFromRegistry method.
You can define whole and partial registry keys as the parameter. For instance, specifying “Software\MyCompany\MyProject" as a partial key will result in settings being saved to the “HKEY_CURRENT_USER\Software\MyCompany\MyProject" path. You can also specify the entire path if you need to store the layout at another root key. An example is the “HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject" registry path.
Example
The following sample code saves a vertical grid’s layout to the registry and then applies it to a different vertical grid. The VGridControlBase.SaveLayoutToRegistry and VGridControlBase.RestoreLayoutFromRegistry methods are used for this purpose.
The image below shows the result.
string registryPath =
"HKEY_LOCAL_MACHINE\\SOFTWARE\\DevExpress Inc\\XtraVerticalGrid";
vGridControl1.SaveLayoutToRegistry(registryPath);
vGridControl2.DataSource = vGridControl1.DataSource;
vGridControl2.RestoreLayoutFromRegistry(registryPath);