I had to do two things to get it to work with VS2010. The first was that the databinding wasn't being brought along when setting the DataContext for ChartBase. That resulted in no data to plot. To fix that I changed ChartBase.OnSeriesSourceChanged to use LoadDataTemplate that loads the content then loops through and sets all the databindings:
private void OnSeriesSourceChanged(IEnumerable oldValue, IEnumerable newValue)
{
this.Series.Clear();
if (newValue != null)
{
foreach (object item in newValue)
{
if (SeriesTemplate != null)
{
ChartSeries series = LoadDataTemplate<ChartSeries>(SeriesTemplate, item);
if (series != null)
{
// set data context
series.DataContext = item;
this.Series.Add(series);
}
}
}
}
UpdateGroupedSeries();
}
private static T LoadDataTemplate<T>(DataTemplate template, object dataContext)
where T : FrameworkElement
{
DependencyObject element = template.LoadContent();
T view = element as T;
view.DataContext = dataContext;
var enumerator = element.GetLocalValueEnumerator();
while (enumerator.MoveNext())
{
var bind = enumerator.Current;
if (bind.Value is BindingExpression)
{
view.SetBinding(bind.Property, ((BindingExpression)bind.Value).ParentBinding);
}
}
return view;
}
Second I had to change the project to including the correct Generic.xaml file. Be sure to use the one under De.TorstenMandelkow.MetroChart.WPF/Themes. It needs to include the BaseChartStyle.
HTH