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


Gets or sets the type of chart content to be serialized.


Serializable content.

Syntax

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

Return Value

A SerializationContent enumeration value that represents the chart content that will be serialized during a load, save or reset operation. By default all non-default chart properties (including data) are persisted.

Example

The following example first serializes all appearance data to disk (only properties with non-default values), then loads the appearance data without resetting the chart's properties to their defaults. 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 provide more control over what is serialized use the Content property. Note that the SerializableContent and NonSerializableContent properties can also be used along with the Content property.

It is important to note that the Content property determines types of chart characteristics to be serialized (e.g. Appearance), and is actually implemented internally as the SerializableContent property. This means that setting the Content property and then setting the SerializableContent property will result in the Content property value being overridden, unless SerializableContent is concatenated. See the sample code below for an example of this.

Setting the Content property will automatically result in the serialization of all ChartArea and Series objects names, so the serialized data concerning chart areas and series will be applied to existing objects when loaded.

Setting this property affects all load, save 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.