XML 命名空间 'clr-namespace:YYY' 中不存在标记 'XXX' [英] The tag 'XXX' does not exist in XML namespace 'clr-namespace:YYY'
问题描述
我已经实现了一个转换器来将 Int32 转换为 String 以便能够将属性绑定到文本框.
I have implemented a converter to convert Int32 to String to be able to binding a property to a textBox.
我在命名空间 MyApp.Converters 中实现了这个转换器,它被称为 Int32ToStringConverter.
I implement this converter in the namespace MyApp.Converters and it is called Int32ToStringConverter.
然后,在我的 axml 中,我添加了对转换器的引用,如下所示:
Then, in my axml I add the reference to my converter as follow:
<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 我有:
Later, in windows.Resources I have:
<Window.Resources>
<**converter:Int32ToStringConverter** x:Key="Int32ToStringConverter" />
</Window.Resources>
我收到错误消息,即命名空间 MyApp.Converters,assembly=MyApp 中不存在标记 Int32ToString 转换器.
I get the error that the tag Int32ToString converter does not exist in the namespace MyApp.Converters,assembly=MyApp.
我在本地硬盘中有项目,在项目属性中,目标 .NET 是框架 4.0,而不是框架 4.0 客户端配置文件,我尝试清除解决方案并重新编译,但问题仍然存在.
I have the project in the local hard drive, in the project properties, the destination .NET is framework 4.0, not framework 4.0 client profile and I try to clear the solution and recompile but the problem persists.
主要是,这是我一直找到的两个解决方案,但没有解决我的问题.
Mainly, this is the two solutions that I always find, but don't resolve my problem.
推荐答案
此处需要进行三个修复:
Three fixes to make here:
- 没有空格 ->
xmlns:converter="clr-namesapce:MyApp.Converters,aseembly=MyApp"
- 没有拼写错误 ->
xmlns:converter="clr-namespace:MyApp.Converters,assembly=MyApp"
- 右分隔符 ->
xmlns:converter="clr-namespace:MyApp.Converters;assembly=MyApp"
来自文档:
请注意,将 clr-namespace 标记与其值分隔开的字符是冒号 (:),而将 assembly 标记与其值分隔开的字符是等号(=).在这两个标记之间使用的字符是分号.此外,请勿在声明中的任何地方包含任何空格.
Note that the character separating the clr-namespace token from its value is a colon (:) whereas the character separating the assembly token from its value is an equals sign (=). The character to use between these two tokens is a semicolon. Also, do not include any whitespace anywhere in the declaration.
这篇关于XML 命名空间 'clr-namespace:YYY' 中不存在标记 'XXX'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!