WPF 图表控件默认存在还是我必须进行外部下载?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21918087/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WPF chart control exists by default or I have to do an external download?
提问by kar
I've been going through previous posts here and also some tutorial videos. It seems like the toolbox option has the chart control option since 4.0 and doesn't need any extra downloads.
我一直在浏览以前的帖子和一些教程视频。似乎工具箱选项从 4.0 开始就有图表控制选项,不需要任何额外的下载。
But in my case, the tool box starts with Pointer, followed by some common WPF controls and then all the WPF controls such as button, canvas and so on. I don't see the chart control.
但就我而言,工具箱以 Pointer 开头,然后是一些常见的 WPF 控件,然后是按钮、画布等所有 WPF 控件。我没有看到图表控件。
Read up that I may be missing an assembly reference. The reference seemed to be:
阅读我可能缺少程序集参考。参考文献似乎是:
System.Windows.Control.dataVisualization.toolkit.dll
System.Windows.Control.dataVisualization.toolkit.dll
When I look up the list, I don't even have such a reference available to import. The closest I had was:
当我查找列表时,我什至没有这样的参考可供导入。我最接近的是:
System.Web.DataVisualization
系统.网络.数据可视化
I imported it and it doesn't work too.
我导入了它,它也不起作用。
Please advice what am I missing. I am looking for chart control to start off and do some simple chart works on my current application. Thank you.
请建议我缺少什么。我正在寻找图表控件来开始并在我当前的应用程序上做一些简单的图表工作。谢谢你。
采纳答案by Aybe
I think this is what you are looking for : http://www.nuget.org/packages/WPFToolkit.DataVisualization/
我认为这就是你要找的:http: //www.nuget.org/packages/WPFToolkit.DataVisualization/
<Window x:Class="drawtextonbitmap.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
Title="MainWindow" Height="350" Width="525">
<Grid>
<chartingToolkit:Chart />
</Grid>
</Window>
If you want it to appear in the ToolBox :
如果您希望它出现在 ToolBox 中:
- right click ToolBox -> Choose Items
- click Browse
- go to your project folder
- open \packages\WPFToolkit.DataVisualization.3.5.50211.1\lib\System.Windows.Controls.DataVisualization.Toolkit.dll
- press Ok
- it will be on 'Common WPF controls' section
- 右键单击工具箱 -> 选择项目
- 点击浏览
- 转到您的项目文件夹
- 打开 \packages\WPFToolkit.DataVisualization.3.5.50211.1\lib\System.Windows.Controls.DataVisualization.Toolkit.dll
- 按确定
- 它将位于“通用 WPF 控件”部分
Make sure to install mentioned package before using the Package Manager Console : http://docs.nuget.org/docs/start-here/using-the-package-manager-console
确保在使用包管理器控制台之前安装提到的包:http: //docs.nuget.org/docs/start-here/using-the-package-manager-console
PM> Install-Package WPFToolkit.DataVisualization

