【发布时间】:2011-08-05 14:54:40
【问题描述】:
我有以下问题:
在我们的应用程序中,我们有一个报告列表,其中包含在运行时定义的子类别...
报告的总体结果显示在 ColumnSeries 中,效果很好。现在我必须在 LineSeries 中显示子类别的结果以进行直接比较,这是行不通的。
这是我到目前为止所拥有的(在后面的代码中):
foreach (var item in ReportListViewModel.ReportSections)
{
var series = new LineSeries();
series.SetBinding(DataPointSeries.ItemsSourceProperty, new Binding("ItemList"));
series.IndependentValuePath = "Date";
series.DependentValuePath = item.BindingPath; // points to an existing entry in a Dictionary<string, double>
series.Title = item.Text;
chart.Series.Add(series);
}
它工作正常,但是一旦加载数据,我会收到一个 InvalidOperationException 说明找不到适合绘制值的轴。
以下工作完全正常(即使它不是我所需要的):
foreach (...)
{
...
series.DependentValuePath = "Result" // Result is the dependent property of the ColumnSeries, and I tested it just to make sure it isn't me
...
}
【问题讨论】:
-
你能举一个“item.BindingPath”值的例子吗?
-
"Sections[Personality]"正如我所说,它是一个字典{ ..., {"Personality", 2.0},...}
标签: c# silverlight silverlight-4.0 charts silverlight-toolkit