【发布时间】:2017-01-26 04:32:59
【问题描述】:
在我的 Xamarin iOS 项目中,我想将一个按钮绑定到一个带有参数的 ICommand。
查看:
var set = this.CreateBindingSet<MyView, MyViewModel>();
set.Bind(Button1).To(vm => vm.EditCommand).WithConversion(new MvxCommandParameterValueConverter(), 1);
set.Apply();
视图模型:
private readonly ICommand editCommand;
public MyViewModel()
{
editCommand = new BaseMvxCommand<int>(DoEditPhoto);
}
public ICommand EditCommand { get { return editCommand; } }
private void DoEditPhoto(int imageNum)
{
// enter code here
}
当我点击按钮时,我无法执行DoEditPhoto()。我是否以错误的方式绑定?谁能帮帮我?
【问题讨论】:
-
什么是 BaseMvxCommand?
-
BaseMvxCommnad 是 MvxCommand 类。该问题与该问题不重复,因为该问题的答案建议使用我已经在使用但不起作用的命令参数。
标签: mvvm xamarin xamarin.ios mvvmcross