Dundas Chart for Windows Forms
SerializableContent Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > ChartSerializer Class : SerializableContent Property


Gets or sets the chart properties that can be serialized.


Comma separated list of serializable (Save/Load/Reset) properties. "ClassName.PropertyName,[ClassName.PropertyName]".

Syntax

Visual Basic (Declaration)  
Public Property SerializableContent As String
Visual Basic (Usage) Copy Code
Dim instance As ChartSerializer
Dim value As String
 
instance.SerializableContent = value
 
value = instance.SerializableContent
C#  
public string SerializableContent {get; set;}

Return Value

A comma-separated string expression that represents the chart properties to be serialized. The syntax is "Class.Property[,Class.Property]".

Example

The following example first serializes all appearance data to disk (only properties with non-default values), and then loads the serialized data. Axis labels are also serialized.

C# Copy Code
// Save chart appearance properties that have non-default values, as well as axis labels.
Chart1.Serializer.Content = SerializationContent.Appearance;

// We can concatenate the Content property string and the SerializableContent string, since the Content
//   property is implemented internally as the SerializableContent property. Since we use the
//   SerializableContent property we also need to persist the ChartArea and Series object's names,
//   otherwise these serialized properties will be applied to new ChartArea and Series objects
//    when the data is loaded.
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Save(
"AppearanceProps.xml");
...

// Load the serialized data.
Chart1.Serializer.Content = SerializationContent.Appearance;
Chart1.Serializer.SerializableContent +=
",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name";
Chart1.Serializer.Load(
"AppearanceProps.xml");
Visual Basic Copy Code
' Save chart appearance properties that have non-default values., as well as axis labels.
Chart1.Serializer.Content = SerializationContent.Appearance

' We can concatenate the Content property string and the SerializableContent string, since the Content
' property is implemented internally as the SerializableContent property. Since we use the
' SerializableContent property we also need to persist the ChartArea and Series object's names,
' otherwise these serialized properties will be applied to new ChartArea and Series objects
' when the data is loaded.
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Save("AppearanceProps.xml")
...

' Load the serialized data
Chart1.Serializer.Content = SerializationContent.Appearance
Chart1.Serializer.SerializableContent += ",DataPoint.AxisLabel,Series.AxisLabels,Series.Name,ChartArea.Name"
Chart1.Serializer.Load("AppearanceProps.xml")

Remarks

By default all chart properties will be serialized when the Save and Load methods are called. To limit chart characteristics to be serialized the SerializableContent property can be used (along with the NonSerializableContent and Content properties).

SerializableContent determines what chart characteristics will be serialized. Wildcards can be used in the string expression, in the same manner as the NonSerializableContent property. For example, to serialize all chart BackColor properties set this property to "*.BackColor".

If chart area and/or series child properties are specified then the names of all ChartArea and Series objects must be also specified in order to have the persisted data applied to existing ChartArea and Series objects (i.e. use "Series.Name" and "ChartArea.Name" expressions). See the sample code below for an example of this. In the same manner if multiple chart areas are being used then the ChartArea property of all plotted series must also be saved.

Sometimes a property can be set to be both serialized and not serialized (common when wildcards are used). NonSerializableContent has a lower priority when compared to the SerializableContent string expression. Note that less weight is given to string expressions that use wildcards. For example, if SerializableContent is set to "*.BackColor" and NonSerializableContent is set to "ChartArea.BackColor" then all BackColor properties except for ChartArea objects will be serialized.

Setting the Content property results in SerializableContent being set internally. If the Content property is set and another property should be serialized then make sure to concatenate SerializableContent when specifying that extra property. See the sample code below for an example of this.

This property affects all save, load and reset operations.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.