Saving and Restoring Gauge Layout and Style Settings
- 2 minutes to read
Gauges, as well as many other DevExpress controls, support save/restore the layout feature. This feature gives you the ability to store different layout versions of your gauges and cycle through them when needed.
Using the GaugeControlBase class API, you can store gauge layouts in XML files, stream or registry.
XML files
To save a gauge layout to a local storage, call the GaugeControlBase.SaveLayoutToXml method. Saved layouts can be restored by utilizing the GaugeControlBase.RestoreLayoutFromXml method.
Stream
Use the GaugeControlBase.SaveLayoutToStream/GaugeControlBase.RestoreLayoutFromStream method pair to save and restore gauge layouts to a System.IO.Stream object.
Registry
When saving gauge layouts to a registry, you can define either whole or partial registry keys. For instance, the ‘Software\MyCompany\MyProject' partial key will result in saving settings 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 (e.g., ‘HKEY_LOCAL_MACHINE\Software\MyCompany\MyProject'). These registry keys are passed to the GaugeControlBase.SaveLayoutToRegistry and GaugeControlBase.RestoreLayoutFromRegistry methods as parameters.
All these methods allow you to save and restore overall gauge layout settings: currently existing Visual Elements, their behavior and style settings. If you do not want your gauge layout to be affected, but rather wish to save and restore various style presets, use related Save(Restore)Style… methods instead. Same as with saving layouts, these methods allow you to save style settings to a local storage or stream, but do not allow you to save them to a registry.
- GaugeControlBase.SaveStyleToXml/GaugeControlBase.RestoreStyleFromXml
- GaugeControlBase.SaveStyleToStream/GaugeControlBase.RestoreStyleFromStream
Gauge paint styles can also be managed by the StyleController component.
Workspace Manager
Additionally to the methods mentioned above, you can utilize the Workspace Manager component. This component provides a centralized way to save layouts of all supported DevExpress controls in one global layout called workspace. This component allows you to create multiple predefined application workspaces that your users will be able to choose from, as well as save and restore their own custom workspaces.