0
votes

I have a website that sends data or questions to all devices (iOS, Android, Windows Phone), using JSON as DB type. WindowsPhone toolkit and Silverlight toolkit are installed with nuget.

The problem is that the Chart prefix is not defined!

sample of code I want to use:

<charting:Chart>
  <charting:PieSeries Title="Test items" ItemsSource="{Binding Items}" DependentValuePath="ItemValue" IndependentValuePath="Title" />
</charting:Chart>

I did search around for a solution I even went to toolbox in VisualStudio & in blend the chart tool doesn't exist even though in Youtube tutorials from 2010 there was a button so I do not know if Silverlight was not installed properly or in the new 2011 or 2012 version they were excluded because the Silverlight one is the only free one and the rest are paid & I want to use this method.

Can you please explain to me the problem and how to fix it?

1

1 Answers

1
votes

In general, you would need to add a namespace statement in the "top" tag of your XAML file:

xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;
                assembly=System.Windows.Controls.DataVisualization.Toolkit"

According to this blog, this approach has been successfully been applied in a Windows Phone 7 application, when the Silverlight Toolkit is downloaded from CodePlex.

However, I am nearly 100% sure that this will not work with Windows Phone 8, since I do not believe the Silverlight Toolkit is compatible with WP8.

In particular, if your VS 2012 solution only contains WP8 projects, NuGet will prevent you from installing the Silverlight Toolkit, since it cannot identify any projects compatible with the toolkit (only Silverlight 4 and higher is supported).

From the top of my head, here are a few commercial Windows Phone toolkits that include chart controls: