How to: Bind a Chart to an XML Data Source using a Complex Data Path

The following example demonstrates how to bind a chart to using a complex data path with dots.

To accomplish this task, it is necessary to add an XmlDataProvider object to a collection of the window's static resources, then assign this resource to a series' Series.DataSource property. Then, set the Series.ArgumentDataMember and Series.ValueDataMember properties to the complex names of XML elements (containing a path to a specific XML node) that should provide data for arguments and value.

Note that this approach to data binding is done completely in XAML, and no code-behind file is required.

<Window x:Class="WpfApplication1.Window1" xmlns="" xmlns:x="" xmlns:dxc="" Title="Window1" Height="491" Width="637">
            <XmlDataProvider x:Key="contacts" Source="Contacts.xml" XPath="/NewDataSet">
        <dxc:ChartControl Name="chartControl1">
                        <dxc:BarSideBySideSeries2D DataSource="{StaticResource contacts}" ArgumentDataMember="Contacts.LastName" ValueDataMember="Contacts.PaymentAmount" />