Forum Xamarin Xamarin.Forms

iOS - ListView ScrollTo animation is jarring

DvTgDvTg BRMember

I picked the DataTemplateSelector tutorial and changed it to scroll to bottom when a message is sent.

It does scroll to the end, but it seems that its not scrolling from the current position. It seems that it jumps up some entries then scrolls to the end.

I saw the #28277 bug report, but this issue is different. It scrolls to the end of the list but the animation is jarring.

Check the changes I made:

public partial class MainPage : ContentPage
    MainPageViewModel vm;

    public MainPage()
        Title = "Monkey Chat";
        vm = new MainPageViewModel();
        BindingContext = vm;

        vm.Messages.CollectionChanged += Messages_CollectionChanged;

// ...

    void Messages_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
    MessagesListView.ScrollTo(MessagesListView.ItemsSource.Cast<object>().LastOrDefault(), ScrollToPosition.End, true);

I attached the project so you can check it out.


Sign In or Register to comment.