我有Win RT Xaml Toolkit的图表,我希望显示像这样的ColumnSeries:
<charting:Chart Name="columnChart" Grid.Row="1" Grid.Column="1" Width="400" Height="400">
<charting:Chart.Series>
<charting:ColumnSeries
ItemsSource="{Binding items}"
IndependentValueBinding="{Binding Name}"
DependentValueBinding="{Binding Value}"
IsSelectionEnabled="True">
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>
但我总是收到此错误:
WinRT信息:无法添加类型实例 'WinRTXamlToolkit.Controls.DataVisualization.Charting.ColumnSeries'到' 一个类型的集合 'System.Collections.ObjectModel.Collection&LT; WinRTXamlToolkit.Controls.DataVisualization.Charting.ISeries&GT;'
这可能是什么原因?
答案 0 :(得分:4)
好的,我找到了,
错误是 ColumnSeries 缺少标题属性,如下所示:
<charting:Chart Name="columnChart" Grid.Row="1" Grid.Column="1" Width="400" Height="400">
<charting:Chart.Series>
<charting:ColumnSeries
Title="Chart Title"
ItemsSource="{Binding items}"
IndependentValueBinding="{Binding Name}"
DependentValueBinding="{Binding Value}"
IsSelectionEnabled="True">
</charting:ColumnSeries>
</charting:Chart.Series>
</charting:Chart>
似乎标题属性是强制性的。