Failed to bind custom MvvmCross views

I have created two Android custom views that I would like to bind to properties in my data model. When I run the application the properties are definitely not bound and I see errors like MvxBind:Error:106.21 View type not found - md5b46e1450448c30667827ca3b24581c6a.NavigationListView

in my logs.

I also had the same problem with android.support.v4.widget.DrawerLayout

which I was able to fix it by adding the assembly to AndroidViewAssemblies

in Setup.cs. I've tried doing the same with my custom views, to no avail. Mine AndroidViewAssemblies

looks like this:

protected override IList<Assembly> AndroidViewAssemblies
{
    get
    {
        var assemblies = base.AndroidViewAssemblies;
        assemblies.Add(typeof(DrawerLayout).Assembly);
        assemblies.Add(typeof(NavigationListView).Assembly);
        return assemblies;
    }
}

      

I noticed that for DrawerLayout

MvxBind I included the full namespace in the log, but for my custom views, it uses the md5 hash instead of the namespace which I believe is related to the problem I see.

This was definite working a few days ago, but it still doesn't work after going back to the code I was using when I know it works. This makes me think that I have a configuration problem.

I am using Visual Studio 2013. I installed StyleCop and updated Reshaper to 8.2 since this latter worked, but I am skeptical about those who break my custom views.

What can be happening and how can I fix it?

+3


source to share


1 answer


As Stewart suggested, this is part of Xamarin breaking the changes in Xamarin 5.1.

I had to do two things to fix this:



  • I had to add [Register("com/example/namespace/CustomViewName")]

    to my custom views to fix them.
  • I updated to MvvmCross 3.5.1 to fix the binding for MvvmCross controls (for example MvxListView

    ).
+4


source







All Articles