【发布时间】:2017-10-30 03:02:39
【问题描述】:
我是 iOS 的 MVVMCross 模型的新手。我想处理 tableview 单元格点击,并获取点击的单元格索引。但我不知道如何访问索引。
这是我的查看代码。
var menuSource = new MenuTableViewSource(menuTableView, MenuCell.Key, MenuCell.Key);
this.menuTableView.Source = menuSource;
var set = this.CreateBindingSet<BooksView, BooksViewModel>();
set.Bind(menuSource).To(vm => vm.MenuCellTexts);
set.Bind(menuSource).For(s => s.SelectionChangedCommand).To(vm => vm.ItemSelectedCommand);
set.Apply();
这是我的 ViewModel 代码。
private MvxCommand _itemSelectedCommand;
public MvxCommand ItemSelectedCommand
{
get
{
_itemSelectedCommand = _itemSelectedCommand ?? new MvxCommand(DoSelectedItem);
return _itemSelectedCommand;
}
}
private void DoSelectedItem()
{
// How to get the tapped cell index here??
}
【问题讨论】:
标签: xamarin xamarin.ios mvvmcross