ChartSerializer.SerializableContent Property

.NET Framework (current version)

Gets or sets the chart properties that can be serialized.

Namespace:   System.Web.UI.DataVisualization.Charting
Assembly:  System.Web.DataVisualization (in System.Web.DataVisualization.dll)

public string SerializableContent { get; set; }

Property Value

Type: System.String

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

By default all chart properties will be serialized when the Save and Load methods are called. You can use the NonSerializableContent property to limit chart characteristics to be serialized, along with the SerializableContent and Content properties.

The SerializableContent property determines which 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 ChartArea and/or Series child properties are specified, then the names of all ChartArea and Series objects must be also specified to enable the persisted data to be applied to existing ChartArea and Series objects; that is, you must specify "Series.Name" and "ChartArea.Name" expressions. See the sample code below for an example of this procedure. Similarly, if multiple chart areas are being used, the ChartArea property of all plotted Series must also be saved.

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

If you set the Content property, the SerializableContent property will be set internally. If the Content property is already set but another property needs to be serialized, make sure to concatenate the SerializableContent property when specifying that extra property. See the sample code below for an example of this procedure.

This property affects all save, load and reset operations.

.NET Framework
Available since 4.0
Return to top