ComponentOne Chart for WPF and Silverlight
Chart for WPF and Silverlight / Chart Features / Data Binding / Collection of Objects
In This Topic
    Collection of Objects
    In This Topic

    Data binding should be used when you have a collection of objects where each object includes numerical properties. There are at least two chart properties involved in the data binding process.

    Suppose we have the array of points in resources:

    Copy Code
    x:Array x:Key="points" Type="Point">

    The following XAML fragment presents the chart with two data series, one is bound to X coordinate of points, and the other is bound to Y coordinate:

    Copy Code
    <c1chart:C1Chart Name="chart2">
     ItemsSource="{Binding Source={StaticResource points}, Path=Items}">
                         <c1chart:DataSeries ValueBinding="{Binding Path=X}"/>
                         <c1chart:DataSeries ValueBinding="{Binding Path=Y}"/>

    The next sample shows the series that uses both coordinates of points at once; note it is the instance of XYDataSeries class that handles two sets of data values which correspond to x- and y-coordinates:

    Copy Code
           XValueBinding="{Binding Path=X}"
           ValueBinding="{Binding Path=Y}"/>


    See Also