State Persistence support helps end users to save the application / controls customization based on their needs. So, it is a very essential feature and some controls may not have support to Serialize and Deserialize its customization settings by built-in. This article will provide guidance to configure State Persistence for those controls in sample application level.
Here we have considered RadialGauge control. At present RadialGauge doesn’t have built-in State Persistence support and its property information can be programmatically saved / load from XML by following below steps.
Step 1: Define Class that helps Serialize / De-Serialize RadialGauge property details and mark it as XMLRoot attribute.
Step 2: Implement required properties of RadialGauge that needs to be Serialized / De-Serialized in this class and mark it as XMLElement attribute.
Step 3: Save those properties using XMLTextWriter class, that helps to store information in XML file.
Step 4: Load those properties using XMLTextReader class, that helps to retrieve information from XML file.
Here, we have Serialized / Deserialized the “Value” and “VisualStyle” properties of RadialGauge control.
The following code demonstrates the same.
Code Example: [C#]
Code Example: [VB]
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|