Silverlight Toolkit:为什么我无法更改 Chart.Series 上的 ItemsSource?

发布于 2024-07-15 17:54:32 字数 821 浏览 3 评论 0 原文

我开始在 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:给定的键 字典中没有出现。

我有什么地方做得不对吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

本王不退位尔等都是臣 2024-07-22 17:54:32

这实际上是图表控件的一个错误,仅在 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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文