Serialization and Deserialization:
23 Oct 2019 / 1 minute to read
SfChart provides the support for serializing and deserializing control. This section explains on how to serialize and deserialize SfChart.
Methods:
Method Name | Description |
---|---|
Serialize() | Serialize the control and saves as the XML file in the parent folder. |
Serialize(string filePath) | Serialize the control and saves as the XML file in the given file path. |
Serialize(Stream stream) | Serialize the control and saves as the XML file in the given stream. |
Deserialize() | Deserialize the XML file from the parent folder and returns the SfChart control object. |
Deserialize(string filePath) | Deserialize the XML file from the given file path and returns the SfChart control object. |
Deserialize(Stream stream) | Deserialize the XML file from the given stream and returns the SfChart control object. |
XAML
C#
<chart:SfChart x:Name=chart>
<chart:ColumnSeries ItemsSource="{Binding CategoricalDatas}" XBindingPath="Category" YBindingPath="Value" Palette="RedChrome"/>
</chart:SfChart>
<StackPanel>
<Button x:Name="Serialize" Content="Serialize" Height="50" Width="100" Margin="10" Click="Serialize_Click"/>
<Button x:Name="Deserialize" Content="Deserialize" Height="50" Width="100" Margin="10" Click="Deserialize_Click"/>
</StackPanel>
private void Serialize_Click(object sender, RoutedEventArgs e)
{
string filePath = @"E:/Documents/chart.xml";
chart.Serialize(filePath);
}
private void Deserialize_Click(object sender, RoutedEventArgs e)
{
string filePath = @"E:/Documents/chart.xml";
var deserializedChart = (SfChart)chart.Deserialize();
}
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page