我实现了一个将Int32转换为String的转换器,以便将属性绑定到textBox上。
我在名为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>
我遇到一个错误,即在命名空间MyApp.Converters中找不到Int32ToString转换器,程序集为MyApp。
我将项目保存在本地硬盘上,在项目属性中,目标.NET框架为4.0,而不是4.0客户端框架,并尝试清除解决方案并重新编译,但问题仍然存在。
主要的解决方案通常是这两种,但都无法解决我的问题。