MvxBind:Error: View type not found - mvvmemiextens

2019-08-05 13:59发布

问题:

I'm using EmiDatePicker but, at open the View a this Error occurs:

MvxBind:Error:452,00 View type not found - mvvmemiextensions.EmiDatePicker 03-13 16:31:21.439 I/mono-stdout(20760): MvxBind:Error:452,00 View type not found - mvvmemiextensions.EmiDatePicker [0:] MvxBind:Error:452,00 View type not found - mvvmemiextensions.EmiDatePicker

At 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" />

At 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:

If you've pulled the EmiPicker's in from a separate Assembly, then you need to let MvvmCross know the Assembly those are in - see https://github.com/MvvmCross/MvvmCross/wiki/Customising-using-App-and-Setup#providing-custom-views-android

If you've copied the EmiPicker's into the current UI Assembly, then you shouldn't need the mvvmemiextensions prefixes

If all else fails, you should be able to use the built-in MvxDatePicker and MvxTimePicker - which were inspired by Emi's work :) See example uses in the ApiExamples sample - e.g. https://github.com/MvvmCross/MvvmCross-Tutorials/blob/master/ApiExamples/ApiExamples.Droid/Resources/Layout/Test_Time.axml