I have a very simple setup: A ContentPage has a ListView as it's only content. The list supports pull to refresh. It is binding to a command:

listView.SetBinding<MyViewModel>(ListView.RefreshCommandProperty, vm => vm.RefreshCommand);
listView.SetBinding<MyPageViewModel>(ListView.IsRefreshingProperty, vm => vm.IsRefreshing);

The list is empty and binds to an empty collection.

The refresh command is:

public ICommand LoadNodesCommand { get; set; }

If I use

LoadNodesCommand = new Command(o => {
  IsRefreshing = true;
  IsRefreshing = false;
});

the list refreshes if I pull and all is fine. Notice that I do not modify the list's data. It's an empty dummy command.

Next I use this as my command instead:

LoadNodesCommand = ReactiveCommand.CreateAsyncObservable(x =>
{
  IsRefreshing = true;
  IsRefreshing = false;

  return System.Reactive.Linq.Observable.Empty<IEnumerable<Item>>();
}

Again, an empty dummy command. But this one makes the ListView behave very strangely. After the pull-to-refresh, it scrolls a bit. After each refresh it scrolls further. I do not use any other Rx methods (I'm not subscribing to the observable). Here's a screenshot of the list after three refreshes. Its first cell has been moved towards the bottom of the screen.

It really should not affect ListView...I'm not touching it, nor its data. I also tried using Device.BeginInvokeMainThread() to set the IsRereshing = false.

enter image description here

0

There are 0 answers