Silverlight Toolkit:为什么我无法更改 Chart.Series 上的 ItemsSource?
我开始在 System.Windows.Controls.DataVisualization.Charting
中尝试新的图表控件(来自 Silverlight 3 Toolkit)
我想绑定一个包含预算列表(名称和值列)的数据表。 当我第一次加载页面时它起作用:
<v:Chart x:Name="BudgetChart"
Title="Budget Distribution">
<v:PieSeries x:Name="PieSeries"
IndependentValueBinding="{Binding Path=CategoryName}"
DependentValueBinding="{Binding Path=Value}"/>
</v:Chart>
我将数据绑定到图表,如下所示:
void RefreshChart()
{
PieSeries.ItemsSource = dataTable;
}
我的问题是,如果我第二次调用 RefreshChart()
,我会得到一个奇怪的异常:
KeyNotFoundException:给定的键 字典中没有出现。
我有什么地方做得不对吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这实际上是图表控件的一个错误,仅在 WPF 端表现出来(在 Silverlight 中工作正常)。 在我按照 Delay 的博客!
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!