Я пишу приложение с помощью Xamarin.Forms и MvvmCross.У меня проблема с моим конвертером.В моем Core
проекте:
public class BoolInverseValueConverter : MvxValueConverter<bool, bool>
{
public bool Convert(bool value, Type targetType, CultureInfo culture, object parameter)
{
return !value;
}
}
В моем Forms
проекте:
namespace MyApp.Forms.NativeConverters
{
public class BoolInverseValueConverter : MvxNativeValueConverter<MyApp.Core.Converters.BoolInverseValueConverter>
{
}
}
В моем xaml:
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="clr-namespace:MyApp.Forms.NativeConverters;assembly=MyApp.Forms"
x:Class="MyApp.Forms.App">
<Application.Resources>
<converters:BoolInverseValueConverter x:Key="BoolInverseValueConverter" />
</Application.Resources>
На моей странице:
<views:MvxContentPage x:TypeArguments="viewModels:LoginViewModel"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:MvvmCross.Forms.Views;assembly=MvvmCross.Forms"
xmlns:mvx="clr-namespace:MvvmCross.Forms.Bindings;assembly=MvvmCross.Forms"
xmlns:viewModels="clr-namespace:MyApp.Core.ViewModels;assembly=MyApp.Core"
xmlns:localviews="clr-namespace:MyApp.Forms.Views;assembly=MyApp.Forms"
xmlns:resx="clr-namespace:MyApp.Core.Resources;assembly=MyApp.Core"
x:Class="MyApp.Forms.Pages.LoginPage"
Title="Login">
<ContentPage.Content>
<localviews:UserLoginView DataContext="{Binding .}" IsVisible="{mvx:MvxBind MyBoolVariable, Converter={StaticResource BoolInverseValueConverter}}"/>
</ContentPage.Content>
</views:MvxContentPage>
Когда я запускаю приложение UWP, я получаю сообщение:
Невозможно назначить свойство «Конвертер»: свойство не существует или не может быть назначеноили несовпадение типа между значением и свойством