views:

351

answers:

4

We're working on a Windows Phone 7 prototype application and we need a Graphing/Charting control to work with. We looked at the Silverlight Toolkit, which has some controls that look like they would work great. However, we can't get that to work. Whenever we add a control to the XAML from that toolkit, it will throw an exception when trying to load the XAML at runtime, even though it appears to work in the designer. I think that it's because there's some dependencies that the phone doesn't actually support.

Does anyone know how to fix the problem or know of charting software that works on Windows Phone 7?

Here's an example of code that doesn't work. We downloaded and installed the 4.0 beta of Silverlight Toolkit. Added the DLL as a reference. Added this to import the namespace:

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

then added this to make a chart:

<c:Chart>
    <c:PieSeries>
        <c:PieSeries.ItemsSource>
            <l:IntList>
                <sys:Int32>23</sys:Int32>
                <sys:Int32>2</sys:Int32>
                <sys:Int32>1</sys:Int32>
                <sys:Int32>34</sys:Int32>
            </l:IntList>
        </c:PieSeries.ItemsSource>
    </c:PieSeries>
</c:Chart>

the designer shows the pie perfectly, however when I try to compile and deploy it throws an exception saying that it can't find the MainPage.xaml. Which leads me to believe that MainPage.xaml isn't compilign correctly (not sure, as I'm still a newbie at Silverlight)

Here's the exception:

System.Windows.Markup.XamlParseException occurred
  Message=2255 An error has occurred. [Line: 36 Position: 2]
  LineNumber=36
  LinePosition=2
  StackTrace:
     ...

on this line:

System.Windows.Application.LoadComponent(this, new System.Uri("/Twitpic;component/MainPage.xaml", System.UriKind.Relative));

Thanks.

+3  A: 

You can probably reuse some of the things provided by the silverlight toolkit, which is open source:
http://silverlight.codeplex.com/Wikipage

You might have to recompile some stuff against the win phone APIs, but it should work :-)

Joel Martinez
+1, or given a little time I'm sure the toolkit team will get round to doing that for you.
AnthonyWJones
I tried that with the WrapPanel before posting this question while messing with some otherthings. But it didn't work. But I'll try again with the charts that we need for this, and post again and let you know how it works out. Thanks
Joel
Unfortunately, I am unable to get it compiled and running using the Windows Phone 7 SDK. Maybe it's only me, but I'm getting the impression that it's not possible without updating the code.
Joel
That's a shame ... hopefully that team will follow up soon with wp7 compatible versions
Joel Martinez
+1  A: 

Playing around more, I was actually able to get Visifire to work. Just had to browse and add the reference to System.Windows.Browser. I don't know if this is the best way to make it work. But it'll do until the Silverlight Toolkit gets updated.

Joel
+1  A: 

Macadamian team developed and gives for free a Chart Control. You can pick it up at http://themobileexperience.macadamian.com/2010/05/chart-control-for-windows-phone-7.html

Ani

Ani