我有以下课程:

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);
    }
}

我得到以下错误:
 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?)

我查看了mvvmcross源代码,bindingInflate确实存在于bindingContext名称空间中。
我遗漏了什么吗??我引用了所有必要的库,包括xamarin.android.support.v4
更新:
我在vs 2013中创建了一个示例项目来说明这个问题。您会注意到fragment1.cs中存在相同的问题:
Sample app

最佳答案

BindingInflate实际上是一种扩展方法。您需要导入正确的命名空间(对于3.5.x版)。

using Cirrious.MvvmCross.Binding.Droid.BindingContext;

对于版本4.x,mvvmcross重新组织了命名空间。正确的导入是:
using MvvmCross.Binding.Droid.BindingContext;

编辑:为应答添加了版本信息,并包含了v4.x的更新命名空间

10-08 03:17