【发布时间】:2015-10-29 12:40:14
【问题描述】:
**This is My ViewModel**
namespace TipCalc.Core
{
public class ProductModel : MvxViewModel
{
public string productname{ get; set;}
public string productprice{ get; set;}
public ProductModel()
{
productname="qwe";
productprice="123";
}
//This is my view model
}
}
**This is my View**
public class ViewOfProduct : MvxFragment
{
public new ProductModel ViewModel
{
get { return (ProductModel) base.ViewModel; }
set { base.ViewModel = value; }
}
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View view = inflater.Inflate (Resource.Layout.ViewOfProduct, container, false);
return view;
}
}
我正在使用 xamrin android 应用程序,我正在使用 MvvmCross。我在视图中得到 ProductModel(ViewModel) 始终为空。所以我无法将数据绑定到控件。帮我解决这个问题。
【问题讨论】: