WinRT XAML Toolkit Visualization error

梦想与她 提交于 2019-12-21 14:07:14

问题


I have a page where I want to put a chart using WinRT Xaml Toolkit Data Visualization Controls.

I have the following code:

   <Charting:Chart x:Name="PieChart" Width="400" Height="400">
        <Charting:Chart.Series>
            <Charting:PieSeries IndependentValuePath="X" DependentValuePath="Y"/>
        </Charting:Chart.Series>
    </Charting:Chart>

VS tells me, PieSeries is wrong: "A value of type 'PieSeries' cannot be added to a collection or dictionary of type 'Collection`1'".

Why is this an error?


回答1:


It's not fully tested, but it seems like this is what the sample does right now, could you do something similar?

<charting:Chart
    x:Name="PieChart"
    Title="Pie Chart"
    Margin="70,0">
    <charting:Chart.Series>
        <Series:PieSeries
            Title="Population"
            ItemsSource="{Binding Items}"
            IndependentValueBinding="{Binding Name}"
            DependentValueBinding="{Binding Value}"
            IsSelectionEnabled="True" />
    </charting:Chart.Series>
</charting:Chart>


来源:https://stackoverflow.com/questions/23226022/winrt-xaml-toolkit-visualization-error

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