Visual Studio does not recognize BindingInflate function of MvxFragment

android, c#, mvvmcross, xamarin, xamarin.android

Solution

`BindingInflate` is actually an extension method. You need to import the correct namespace (for version 3.5.x).

using Cirrious.MvvmCross.Binding.Droid.BindingContext;

For version 4.x, MvvmCross has reorganized the namespaces. The correct import is:

using MvvmCross.Binding.Droid.BindingContext;

EDIT: Added version info to answer and included updated namespace for v4.x

Problem

I have the following class: ``` using Cirrious.MvvmCross.Binding.BindingContext; using Cirrious.MvvmCross.Droid.Views; using Cirrious.MvvmCross.Droid.Fragging; using Cirrious.MvvmCross.Droid.Fragging.Fragments; public class DifficultyItemFragment : MvxFragment { public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var ignored = base.OnCreateView(inflater, container, savedInstanceState); return this.BindingInflate(Resource.Layout.DifficultyItemFragment, null); } } ``` and I get the following error: ``` Error 8 ...'QuickShift.Android.Views.DifficultyItemFragment' does not contain a definition for 'BindingInflate' and no extension method 'BindingInflate' accepting a first argument of type 'QuickShift.Android.Views.DifficultyItemFragment' could be found (are you missing a using directive or an assembly reference?) ``` I looked at the MvvmCross source code and BindingInflate does indeed exist within the BindingContext namespace. Am I missing something?? I have all the necessary libraries referenced, including Xamarin.Android.Support.v4 UPDATE: I've created a sample project in VS 2013 to illustrate the problem. You'll notice that in Fragment1.cs the same problem exists: Sample app

Original source