MvxBind:错误:找不到视图类型 - mvvmemiextensions.EmiDatePicker

时间:2014-03-13 19:45:12

标签: c# android xamarin.android xamarin mvvmcross

我正在使用EmiDatePicker但是,在打开View a this Error时会发生:

MvxBind:错误:452,00未找到视图类型 - mvvmemiextensions.EmiDatePicker 03-13 16:31:21.439 I / mono-stdout(20760):MvxBind:错误:452,00查看类型未找到 - mvvmemiextensions.EmiDatePicker [0:] MvxBind:错误:452,00查看类型未找到 - mvvmemiextensions.EmiDatePicker

在AXML ...

<mvvmemiextensions.EmiDatePicker
local:MvxBind="Value SomeDateValue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:textColor="#000000"
android:textSize="18dp" />

在Setup.cs

protected override void FillTargetFactories(IMvxTargetBindingFactoryRegistry registry)
{
        try
        {
            registry.RegisterFactory(new MvxSimplePropertyInfoTargetBindingFactory(typeof(EmiDatePickerValueTargetBinding), typeof(EmiDatePicker), "Value"));
            registry.RegisterFactory(new MvxSimplePropertyInfoTargetBindingFactory(typeof(EmiTimePickerValueTargetBinding), typeof(EmiTimePicker), "Value"));

            base.FillTargetFactories(registry);
        }
        catch (Exception ex)
        {
            throw;
        }
    }

1 个答案:

答案 0 :(得分:4)

如果您从一个单独的大会中拉出了EmiPicker,那么您需要让MvvmCross知道那些所在的大会 - 请参阅https://github.com/MvvmCross/MvvmCross/wiki/Customising-using-App-and-Setup#providing-custom-views-android

如果您已将EmiPicker复制到当前的UI程序集中,那么您不应该需要mvvmemiextensions前缀

如果所有其他方法都失败了,你应该能够使用内置的MvxDatePicker和MvxTimePicker - 这些都受到了Emi的工作的启发:)参见ApiExamples示例中的示例用法 - 例如https://github.com/MvvmCross/MvvmCross-Tutorials/blob/master/ApiExamples/ApiExamples.Droid/Resources/Layout/Test_Time.axml