Forum Xamarin.Forms

Listview auto scroll one item at a time

nonubittanonubitta Member ✭✭

I have listview which has a story with around 50-60 rows. I want to slowly scroll listview automatically.
So that user can continue to read without manually scrolling.


  • jezhjezh Member, Xamarin Team Xamurai
    edited June 2020

    I think you can try to use ListView.ScrollTo to achieve this.

    We can scroll to the last one item.
    For example:

    lstView.ScrollTo(veggies[veggies.Count-1], ScrollToPosition.MakeVisible ,true);
  • nonubittanonubitta Member ✭✭
    But ScrollTo will only scroll to a specified position once. I want continuous scrolling slowly.
  • jezhjezh Member, Xamarin Team Xamurai

    You can refer to this article: Infinite Scrolling ListView For Xamarin.Forms App Using Behaviors
    which uses Behaviors to achieve this function.

    The main code is

    public class InfiniteScroll: Behavior < ListView > {    
            public static readonly BindableProperty LoadMoreCommandProperty = BindableProperty.Create("LoadMoreCommand", typeof(ICommand), typeof(InfiniteScroll), null);    
            public ICommand LoadMoreCommand {    
                get {    
                    return (ICommand) GetValue(LoadMoreCommandProperty);    
                set {    
                    SetValue(LoadMoreCommandProperty, value);    
            public ListView AssociatedObject {    
                private set;    
            protected override void OnAttachedTo(ListView bindable) {    
                AssociatedObject = bindable;    
                bindable.BindingContextChanged += Bindable_BindingContextChanged;    
                bindable.ItemAppearing += InfiniteListView_ItemAppearing;    
            private void Bindable_BindingContextChanged(object sender, EventArgs e) {    
            protected override void OnBindingContextChanged() {    
                BindingContext = AssociatedObject.BindingContext;    
            protected override void OnDetachingFrom(ListView bindable) {    
                bindable.BindingContextChanged -= Bindable_BindingContextChanged;    
                bindable.ItemAppearing -= InfiniteListView_ItemAppearing;    
            void InfiniteListView_ItemAppearing(object sender, ItemVisibilityEventArgs e) {    
                var items = AssociatedObject.ItemsSource as IList;    
                if (items != null && e.Item == items[items.Count - 1]) {    
                    if (LoadMoreCommand != null && LoadMoreCommand.CanExecute(null)) LoadMoreCommand.Execute(null);    
  • nonubittanonubitta Member ✭✭
    edited June 2020
    I am not looking for infinite scroll. I am looking for automatic scroll where listview keeps on scrolling one item at a time by itself. Not requiring user to interact.
  • LardeCristoLardeCristo Member ✭✭
    edited June 2020

    Hi, use 'looping'


    looping a < 60 or "ListView.length"

Sign In or Register to comment.