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