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".

<Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" xmlns:col="clr-namespace:System.Collections;assembly=mscorlib" Title="Window1" Height="306" Width="378">
    <Window.Resources>
        <ResourceDictionary>
            <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" />
            </col:ArrayList>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <dxc:ChartControl Name="chartControl1">
            <dxc:ChartControl.Diagram>
                <dxc:XYDiagram2D>
                    <dxc:XYDiagram2D.Series>
                        <dxc:BarSideBySideSeries2D DataSource="{StaticResource Data}" ArgumentDataMember="X" ValueDataMember="Y" ColorEach="True" />
                    </dxc:XYDiagram2D.Series>
                </dxc:XYDiagram2D>
            </dxc:ChartControl.Diagram>
        </dxc:ChartControl>
    </Grid>
</Window>