Xamarin.forms ';转换器';是一个未声明的前缀
我试图按照指南向页面添加转换器,但出现以下错误:Xamarin.forms ';转换器';是一个未声明的前缀,xamarin.forms,Xamarin.forms,我试图按照指南向页面添加转换器,但出现以下错误: 'converters' is an undeclared prefix. Line 8, position 14. 我的页面的开头如下所示: <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microso
'converters' is an undeclared prefix. Line 8, position 14.
我的页面的开头如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Historation.Views.NewPartPage"
xmlns:converter="clr-namespace:App.Converter">
<ContentPage.Resources>
<ResourceDictionary>
<converters:IntEnumConverter x:Key="IntEnum"/> //<- error on this line
</ResourceDictionary>
</ContentPage.Resources>
namespace App.Converter
{
public class IntEnumConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Enum)
{
return (int)value;
}
return 0;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int)
{
return Enum.ToObject(targetType, value);
}
return 0;
}
}
}
我做错了什么导致了这个错误 转换器需要是不带S的转换器,用于从错误的在线指南复制和粘贴的任何其他人-_-
<converter:IntEnumConverter x:Key="IntEnum"></converter:IntEnumConverter>