Skip to main content

How to: Bind a Chart to a Static Resource

The following example demonstrates how to bind a chart to an ArrayList containing Point objects. For this, it is necessary to declare an array list as a static resource, bind it to a series’ Series.DataSource property and set the Series.ArgumentDataMember to “X” and the Series.ValueDataMember to “Y”.

View Example

<Window x:Class="WpfApplication1.Window1" xmlns="" xmlns:x="" xmlns:dxc="" xmlns:col="clr-namespace:System.Collections;assembly=mscorlib" Title="Window1" Height="306" Width="378">
            <col:ArrayList x:Key="Data">
                <Point X="1" Y="12" />
                <Point X="2" Y="17" />
                <Point X="3" Y="20" />
                <Point X="4" Y="22" />
                <Point X="5" Y="30" />
        <dxc:ChartControl Name="chartControl1">
                        <dxc:BarSideBySideSeries2D DataSource="{StaticResource Data}" ArgumentDataMember="X" ValueDataMember="Y" ColorEach="True" />