On a UITableView, can SelectionChangedCommand and OnTableViewScrolled not coexist?

I've been trying to create a UITableView bound to an ObservableCollection in the ViewModel that will load more items when scrolling down. I also want to be able to show more details of an item when it is selected. This is the code I started with:

public override void ViewDidLoad ()
base.ViewDidLoad ();

    var source = new MvxSimpleTableViewSource (ReceivablesTableView, ReceivableCell.Key, ReceivableCell.Key);
    ReceivablesTableView.Source = source;

    var set = this.CreateBindingSet<ReceivablesListView, ReceivablesListViewModel> ();
    set.Bind (source).To (vm => vm.Receivables);
    set.Bind (source).For (s => s.SelectionChangedCommand).To (vm => vm.ShowDetailCommand);
    set.Apply ();
    ReceivablesTableView.Scrolled += OnTableViewScrolled;

This loads and shows all of the items correctly; however, I found that, unless I remove the event handler assignment to ReceivablesTableView.Scrolled, the SelectionChangedCommand never seems to fire. Conversely, if I move the handler up so that it's the first command called, then SelectionChangedCommand fires, but OnTableViewScrolled does not.

Can these two events not coexist? Is there something that I'm not doing correctly?

Sign In or Register to comment.