我的问题是针对 iOS 中的 MVVMCross 的。我有一个自定义的 TableView 和一个 detailView。如何绑定我的“showDetailCommand”,所以当用户单击 TableView 上的其中一行并触发 RowSelected 以切换到 detailViewModel 时?
这是我的代码结构:
public class SearchResultsViewModel: MvxViewModel
{
    private MvxCommand _showDetailCommand;
    public IMvxCommand ShowDetailCommand
    {
        get
        {
            _showDetailCommand = _showDetailCommand ?? new MvxCommand(ShowDetailCommandHandler);
            return _showMapCommand;
        }
    }
    private void ShowDetailCommandHandler()
    {
        ShowViewModel<ResultDetailViewModel>(new
            {
                city = _filter.City,
                state = _filter.State,
                interstate = _filter.Interstate,
                travelPlaza = _filter.SearchTravelPlaza,
                hasCatScale = _filter.HasCatScale,
                hasWashoutExpress = _filter.HasWashoutExpress,
                hasUndercarriage = _filter.HasUndercarriage,
                nearest = _nearest
            });
    }
}
[Register("SearchResults")]
public class SearchResultsView : MvxTableViewController
{
    public override void ViewDidLoad()
    {
                Title = "List";
                base.ViewDidLoad();
                var source = new TableViewSource(TableView);
                var bindings = this.CreateBindingSet<SearchResultsView, SearchResultsViewModel>();
                bindings.Bind(source).To(vm => vm.Items);
                bindings.Apply();
                TableView.BackgroundColor = UIColor.Clear;
                TableView.ShowsVerticalScrollIndicator = false;
                TableView.ScrollEnabled = true;
                TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None;
                TableView.Source = source;
                TableView.ReloadData();
    }
    public class TableViewSource : MvxTableViewSource
    {
        public TableViewSource(UITableView tableView)
            : base(tableView)
        {
            tableView.RegisterClassForCellReuse(typeof(TableViewCell), TableViewCell.CellIdentifier);
        }
        public override float GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
        {
            var item = GetItemAt(indexPath);
            return TableViewCell.CellHeight(item);
        }
        protected override UITableViewCell GetOrCreateCellFor(UITableView tableView, NSIndexPath indexPath, object item)
        {
            var cell = tableView.DequeueReusableCell(TableViewCell.CellIdentifier) ?? new TableViewCell();
            return cell;
        }
    }
}
[Register("TableViewCell")]
public class TableViewCell : MvxTableViewCell
{
    public static readonly NSString CellIdentifier = new NSString("TableViewCell");
     public TableViewCell()
        : base()
    {
        Initialise();
    }
    public TableViewCell(IntPtr handle)
        : base(handle)
    {
        Initialise();
    }
    private void Initialise()
    {
        var titleLabel = new UILabel(new RectangleF(10, 2, 200, 25));
        Add(titleLabel);
        this.DelayBind(() =>
        {
            var bindings = this.CreateBindingSet<TableViewCell, SearchResultsItemViewModel>();
            bindings.Bind(titleLabel).For(x => x.Text).To(vm => vm.Name);
            bindings.Bind(??).For(x => x.SelectionChangeCommand).To(vm => vm.showDetailCommand); // what should be in this line ??
            bindings.Apply();
        });
    }
}