I have created a class library(CustomMapControl) in the solution and inside this class library I create a UserControl(MapItemsControl).
Now, I added a reference of this class library to both projects (Portogruaro & Trieste).
Here is my solution structure.
Portogruaro is the main project and has all files, Trieste has almost all the files which Portogruaro have added as a reference.
So, the problem is when I tried to use the CustomMapControl and drag and drop it in xaml from toolbox it doenst build and give this error
命名空间“clr-namespace:自定义地图控件”中不存在名称“MapsItemControl”
有时它会显示此错误
元素已经是另一个元素的子元素
这是xaml命名空间
xmlns:cc="clr-namespace:CustomMapControl"
这是 xaml 中的用户控件
<cc:MapItemsControl /> <cc:MapItemsControl />
当我从不同的项目打开 xaml 文件时,错误发生变化。
我想要在其中包含此 UserControl 的 xaml 文件也在两个项目之间共享。
我很确定这是一个引用问题。
我不知道如何引用 CustomMapControl,因此它适用于这两个项目。
您可能对如何在 wpf 项目中添加命名空间有疑问。代替:
xmlns:cc="clr-namespace:CustomMapControl"
尝试这个:
xmlns:cc="clr-namespace:CustomMapControl;assembly=CustomMapControl"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)