[英]Visual Studio does not recognize BindingInflate function of MvxFragment
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. 我查看了MvvmCross源代码,BindingInflate确实存在于BindingContext命名空间中。
Am I missing something?? 我错过了什么? I have all the necessary libraries referenced, including Xamarin.Android.Support.v4
我引用了所有必需的库,包括Xamarin.Android.Support.v4
UPDATE: 更新:
I've created a sample project in VS 2013 to illustrate the problem. 我在VS 2013中创建了一个示例项目来说明问题。 You'll notice that in Fragment1.cs the same problem exists:
您会注意到在Fragment1.cs中存在同样的问题:
BindingInflate
is actually an extension method. BindingInflate
实际上是一种扩展方法。 You need to import the correct namespace (for version 3.5.x). 您需要导入正确的命名空间(对于版本3.5.x)。
using Cirrious.MvvmCross.Binding.Droid.BindingContext;
For version 4.x, MvvmCross has reorganized the namespaces. 对于版本4.x,MvvmCross重新组织了名称空间。 The correct import is:
正确的导入是:
using MvvmCross.Binding.Droid.BindingContext;
EDIT: Added version info to answer and included updated namespace for v4.x 编辑:添加版本信息以回答并包含v4.x的更新名称空间
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.