我写了这两个转换器,但它们没有被“调用”......我是否需要在minisetup.cs文件中添加额外的代码才能使它们正常工作
public class BooleanNegationValueConverter : IMvxValueConverter
{
#region IMvxValueConverter implementation
public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return (!(Boolean)(value));
}
public object ConvertBack (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException ();
}
#endregion
我以通常的方式使用它
set.Bind(toolbar.hidden).To(vm => vm.toolbarstate).WithConversion("BooleanNegation");
我正在使用MvvmcrossCore
答案 0 :(得分:0)
自己弄清楚..
//Register the converters
IMvxValueConverterRegistry converterRegistery = ioc.Resolve<IMvxValueConverterRegistry>();
converterRegistery.AddOrOverwrite ("BooleanNegationConverter", new BooleanNegationValueConverter ());
converterRegistery.AddOrOverwrite ("ExchangeRatetoStringValueConverter", new ExchangeRatetoStringValueConverter ());