Windows Phone 7 图表/图形控件 [英] Windows Phone 7 Charting/Graphing Controls
问题描述
我们正在开发一个 Windows Phone 7 原型应用程序,我们需要一个图形/图表控件来使用.我们查看了 Silverlight 工具包,其中有一些看起来效果很好的控件.但是,我们无法让它发挥作用.每当我们从该工具包向 XAML 添加控件时,它会在尝试在运行时加载 XAML 时抛出异常,即使它在设计器中似乎可以正常工作.我认为这是因为手机实际上并不支持某些依赖项.
有谁知道如何解决问题或知道适用于 Windows Phone 7 的图表软件吗?
这是一个不起作用的代码示例.我们下载并安装了 Silverlight Toolkit 的 4.0 测试版.添加了 DLL 作为参考.添加此以导入命名空间:
xmlns:c="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"`
然后添加这个来制作图表:
<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:图表>
设计器完美地显示了饼图,但是当我尝试编译和部署它时,它抛出一个异常,说它找不到 MainPage.xaml.这让我相信 MainPage.xaml 没有正确编译(不确定,因为我仍然是 Silverlight 的新手)
这是一个例外:
System.Windows.Markup.XamlParseException 发生消息=2255 发生错误.[行:36 位置:2]行号=36线位置=2堆栈跟踪:...
在这一行:
System.Windows.Application.LoadComponent(this, new System.Uri("/Twitpic;component/MainPage.xaml", System.UriKind.Relative));
看起来其他人遇到了与您相同的问题,并使用 Silverlight Toolkit 版本 3 解决了该问题
http://silverlightfeeds.com/post/2502/Windows_Phone_7_RTM_charting_using_the_Silx/p>
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));
It looks like someone else has had the same issue as you and solved it by using the Silverlight Toolkit version 3
这篇关于Windows Phone 7 图表/图形控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!