WinRT Xaml Toolkit Column Series Error?

一曲冷凌霜 提交于 2019-12-12 11:34:20

问题


I have a Chart from Win RT Xaml Toolkit that I want to display a ColumnSeries like this:

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

but I always receive this error:

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

What can be the reason for this?


回答1:


OK I found it,

The error was the ColumnSeries was missing the Title attribute, like this:

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

It seems that the Title attribute is mandatory.



来源:https://stackoverflow.com/questions/15596813/winrt-xaml-toolkit-column-series-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!