I'm trying to bind to the graph control in Xceed (Wpf toolkit extended plus).
However, the documentation has left me more confused...
It says
The data points of a series can be set directly using the DataPoints property, but they can also be set by binding the DataPointsSource property of the Series class to a source and then populating DataPointBindings with BindingInfo objects, which store binding information for a single property of the DataPoint class. Use the BindingInfo.Binding property to set the Binding object for a given DataPoint property (i.e., Content, Label, X, or Y) and use the BindingInfo.PropertyName property (whose type is DataPointPropertyName) to set the property to use binding for.
So, my XAML is
<StackPanel.Resources>
<loc:BackupResultsViewModel x:Key="MyVm" />
<CollectionViewSource x:Key="StatusCollection" Source="{Binding Source={StaticResource MyVm}, Path=MyData}" />
</StackPanel.Resources>
<xctk:Chart Height="30" Width="300" ShowLegend="True" >
<xctk:Chart.Legend>
<xctk:Legend Dock="Left" AllowResize="False" AllowDock="True" AllowMove="True" Title="Legend"/>
</xctk:Chart.Legend>
<xctk:Chart.Areas>
<xctk:Area Title="Overall status" >
<xctk:Area.XAxis>
<xctk:Axis ShowAxisLabel="False" ShowTickLabels="False" ShowTicks="False"/>
</xctk:Area.XAxis>
<xctk:Area.YAxis>
<xctk:Axis ShowAxisLabel="False" ShowTickLabels="False" ShowTicks="False"/>
</xctk:Area.YAxis>
<xctk:Area.Series>
<xctk:Series Title="Overall status" DataPointsSource="{Binding Source={StaticResource StatusCollection}}">
<xctk:Series.Layout>
<xctk:PieLayout />
</xctk:Series.Layout>
<xctk:Series.DataPointBindings>
<xctk:BindingInfo PropertyName="Y">
<xctk:BindingInfo.Binding>
<Binding/>
</xctk:BindingInfo.Binding>
</xctk:BindingInfo>
<xctk:BindingInfo PropertyName="X">
<xctk:BindingInfo.Binding>
<Binding/>
</xctk:BindingInfo.Binding>
</xctk:BindingInfo>
<xctk:BindingInfo PropertyName="Label">
<xctk:BindingInfo.Binding>
<Binding/>
</xctk:BindingInfo.Binding>
</xctk:BindingInfo>
</xctk:Series.DataPointBindings>
</xctk:Series>
</xctk:Area.Series>
</xctk:Area>
</xctk:Chart.Areas>
</xctk:Chart>
and my code behind is
public GraphViewModel()
{
this.Title = title;
var data = new DataPointsList<DataPoint>();
data.Add(new DataPoint(0, 8, "0"));
data.Add(new DataPoint(1, 4, "1"));
data.Add(new DataPoint(2, 3, "2"));
data.Add(new DataPoint(3, 2, "3"));
this.MyData = data;
}
public DataPointsList<DataPoint> MyData { get; set; }
The graph shows, but, never with any data.
So, how can I get binding to work with my graphs?