【发布时间】:2014-01-26 13:01:24
【问题描述】:
在 c# 代码中的 silverlight 应用程序中,我从 WCF RIA 服务获取数据。 然后我想将这个数据(List)传递给图表(System.Windows.Forms.DataVisualization.Charting.Chart)轴转换器参数。
this.specialDayClient = new SpecialDayClient();
this.specialDayClient.SpecialDayLoaded += new EventHandler(specialDayClient_SpecialDaysLoaded);
this.specialDayClient.SpecialDayLoadFailed += new EventHandler(specialDayClient_SpecialDaysLoadFailed);
private void specialDayClient_SpecialDaysLoaded(object sender, EventArgs e)
{
specialDays = sender as IEnumerable<SpecialDay>;
var binding = new Binding("ConverterBinding")
{
Converter = new DateToColorConverter(),
ConverterParameter = specialDays
};
var setter = new Setter(ForegroundProperty, binding);
((DateTimeAxis)chartCashRemainders.Axes[0]).AxisLabelStyle.Setters.Add(setter);
//After this row I get error message "Error HRESULT E_FAIL has been returned from a call to a COM component."
}
private void specialDayClient_SpecialDaysLoadFailed(object sender, EventArgs e)
{
specialDays = new List<SpecialDay>();
}
在 ((DateTimeAxis)chartCashRemainders.Axes[0]).AxisLabelStyle.Setters.Add(setter); 之后,我收到错误消息“错误 HRESULT E_FAIL 已从调用COM 组件。”
我的错误在哪里?
【问题讨论】:
标签: c# silverlight xaml collections converter