views:

1500

answers:

1

I'm starting to experiment with the new chart controls in System.Windows.Controls.DataVisualization.Charting (from the Silverlight 3 Toolkit)

I want to bind a data table that contains a list of budgets (name & value column). It works when I first load my page:

<v:Chart x:Name="BudgetChart" 
         Title="Budget Distribution">
    <v:PieSeries x:Name="PieSeries" 
                 IndependentValueBinding="{Binding Path=CategoryName}"
                 DependentValueBinding="{Binding Path=Value}"/>
</v:Chart>

I bind my data to the chart like this:

void RefreshChart()
{ 
    PieSeries.ItemsSource = dataTable;
}

My problem, is that if I call RefreshChart() a second time, I get a bizarre exception:

KeyNotFoundException: The given key was not present in the dictionary.

Is there something I'm not doing right?

+2  A: 

This was actually a bug with the charting controls that only manifested itself on the WPF side (works fine in Silverlight). The issue has been fixed quickly after I reported it as reported on Delay's Blog!

Anthony Brien