windows-runtime – WinRT Xaml Toolkit列系列错误?

我有一个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 information: Cannot add instance of type
‘WinRTXamlToolkit.Controls.DataVisualization.Charting.ColumnSeries’ to
a collection of type
‘System.Collections.ObjectModel.Collection<WinRTXamlToolkit.Controls.DataVisualization.Charting.ISeries>’

这可能是什么原因?

最佳答案
好的我找到了,

错误是ColumnSeries缺少Title属性,如下所示:

<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>

似乎Title属性是必需的.

转载注明原文:windows-runtime – WinRT Xaml Toolkit列系列错误? - 代码日志