我已经实现了一个转换器来将 Int32 转换为 String,以便能够将属性绑定(bind)到文本框。
我在命名空间 MyApp.Converters 中实现了这个转换器,它被称为 Int32ToStringConverter。
然后,在我的 axml 中,我添加了对转换器的引用,如下所示:
<Window x:Class="MusicaDB.Views.PrincipalView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
**xmlns:converter="clr-namesapce:MyApp.Converters, aseembly=MyApp**">
后来,在 windows.Resources 我有:
<Window.Resources>
<**converter:Int32ToStringConverter** x:Key="Int32ToStringConverter" />
</Window.Resources>
我收到标签 Int32ToString 转换器在命名空间 MyApp.Converters,assembly=MyApp 中不存在的错误。
我在本地硬盘驱动器中有项目,在项目属性中,目标.NET 是框架 4.0,而不是框架 4.0 客户端配置文件,我尝试清除解决方案并重新编译,但问题仍然存在。
主要是,这是我一直找到的两个解决方案,但不能解决我的问题。
最佳答案
就我而言,包含命名空间的程序集实际上并不存在 .
我检查了存在构建错误的程序集的引用,并查看了相关引用程序集的属性。
我导航到路径并发现程序集确实丢失了(我意识到这是我自己做的),从而导致了误导性错误。
关于wpf - XML 命名空间 'XXX' 中不存在标记 'clr-namespace:YYY',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9151366/