How do I bind series in XAML? Something like an ItemsSource (SeriesSource?) property with a SeriesTemplate - to set the DataMapping and other series properties - would make the most sense to me. If this is not possible, then does anyone have an attached property that would do the equivalent work.
Hi,
Is this code applicable for implementation through MVVM also?
Thanks,
VJ
I solved my problem !
Your code doesn't manage Multibinding... I just modified your SetSeriesBindings method like that :
private void SetSeriesBindings(Series series)
{
if (SeriesTemplate == null)
return;
}
foreach (DependencyProperty dp in
DependencyPropertyEnumerator.DependencyProperties(typeof(Series)))
object value;
BindingExpression be;
if (DependencyPropertyEnumerator.
DependencyPropertyHasBinding(
SeriesTemplate, dp, out be))
series.SetBinding(dp, be.ParentBinding);
else if (DependencyPropertyEnumerator.
DependencyPropertyHasValue(
SeriesTemplate, dp, out value))
if (!typeof(MultiBindingExpression).IsAssignableFrom(value.GetType()))
series.SetValue(dp, value);
else
series.SetBinding(dp, ((MultiBindingExpression)value).ParentMultiBinding);
It's pretty dirty but it works.
Steph
Hello Graham,
I have a little problem with your SeriesBinder code (the WPF version with xamchart) ; if I use multibinding or triggers, I have an exception which says that the object is not sharable ; see my code below :
<core:SeriesBinder.BindingInfo>
<core:SeriesBindingInfo ItemsSource="{Binding SeriesCollection}">
<core:SeriesBindingInfo.SeriesTemplate>
<igCA:Series
ChartType="{Binding ChartType}"
DataMapping="{Binding DataMapping}"
DataSource="{Binding DataSource}"
StrokeThickness="2"
Label="{Binding Label}"
>
<igCA:Series.Fill>
<MultiBinding Converter="{StaticResource myConv}">
<MultiBinding.Bindings>
<Binding Path="ParentObject.Consolidation.Name"/>
<Binding Path="ParentObject.Consolidation.Colour"/>
</MultiBinding.Bindings>
</MultiBinding>
</igCA:Series.Fill>
</igCA:Series>
</core:SeriesBindingInfo.SeriesTemplate>
</core:SeriesBindingInfo>
</core:SeriesBinder.BindingInfo>
The thing is, with a xamDataChart, it works very well cause I think the whole code is inside a DataTemplate.... is there a way to have the same thing with a xamChart ?
Thanks
Could you share the code you are using to refresh the data?
-Graham
I am having one issue that I cannot figure out when using the SeriesBindingInfo classes. If I reload the data that is used with the chart, my chart does not refresh automatically. Is there something that I am missing in order to get this to work properly?