5
votes

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
The author of the toolkit basically says you need to work around it. winrtxamltoolkit.codeplex.com/workitem/810Jim Yarbro

1 Answers

0
votes

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>