我试图在我的解决方案中使用WPF的动态数据显示库.我DynamicDataDisplay.dll在我的项目中添加了一个引用.我还在.xaml中添加了一个名称空间,如下所示:xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
当我尝试从动态数据显示库添加元素时,Intellisense没有帮助我.当我在.xaml中输入类似这样的内容时:
<d3:ChartPlotter></d3:ChartPlotter>
Run Code Online (Sandbox Code Playgroud)
Visual Studio会将其标记为错误,其中包含以下文字:
The type 'd3:ChartPlotter' was not found. Verify that you are not missing an
assembly reference and that all referenced assemblies have been built.
Run Code Online (Sandbox Code Playgroud)
但奇怪的是它仍在编译.有人可以告诉我我做错了什么吗?
下面是一个示例代码,它编译得很好,但在设计器中显示错误:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
Title="MainWindow" Height="350" Width="525">
<Grid>
<d3:ChartPlotter></d3:ChartPlotter>
</Grid>
Run Code Online (Sandbox Code Playgroud)
编辑:
我尝试了像Merlyn Morgan-Graham建议的名称空间声明,但它仍然不起作用.发生了另一个错误
Unable to load the metadata for assembly 'DynamicDataDisplay'.
This assembly may have been downloaded from the web.
See http://go.microsoft.com/fwlink/?LinkId=179545. The following error was encountered
during load: etc.
Run Code Online (Sandbox Code Playgroud)
看起来下载的程序集需要手动解锁.这可以在Windows文件属性中完成.解除阻塞并重新启动Visual Studio后问题得以解决.