We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set scroll position to max


I tried this methods separately to scroll to bottom but they didn't work properly.

MyListView.LayoutManager as LinearLayout).ScrollToRowIndex(ViewModel.Messages.Count);

It works when I do

MyListView.LayoutManager as LinearLayout).ScrollToRowIndex(ViewModel.Messages.Count);
await Task.Delay(1000);
MyListView.LayoutManager as LinearLayout).ScrollToRowIndex(ViewModel.Messages.Count);

I believe the reason is because the list contains images and their sizes grows after loading from web.

I believe if I do something like MyListView.ScrollBar.Position = MyListView.ScrollBar.Max; it should work. Maybe you have any other suggestion?

3 Replies

DB Dinesh Babu Yadav Syncfusion Team September 1, 2017 02:02 AM UTC

Hi Almis, 
Sorry for the inconvenience caused. 
We have checked the reported query “ListView does not scroll when scroll by ScrollToRowIndex” in the latest SfListView version(v15.3.0.26) and able to reproduce the issue at our end. We would like to let you know that while using AutoFitMode as “Height” or grouping scenarios in the application, you can overcome this issue by setting the ItemSize as largest item’s height.   
Example, if items height are range between 100 to 300, then you can set the ItemSize as greater than 300 (even you can set as 500).   
For your reference, we have attached the sample and you can download it from the below link.  
Why the issue occurs in SfListView? 
Because the scrollable height of the ScrollView (Which is loaded inside the ListView internally) will be calculated by item’s size(50) and total items count(100) i.e., 50 * 100 = 5000. So if we set the lesser item size, then scrollable height of the ScrollView will be less than its actual scrollable height and thus the ScrollView doesn’t scroll beyond that height. And even if we adjust the height at runtime and scroll to that extent programmatically from Portable project, it doesn’t scrolled as its corresponding native ScrollView doesn’t updated yet. This is the known limitation in Xamarin.Forms framework. However we are checking the possibilities of overcome this limitation by any workaround in our source level as promised earlier. Until then, you can overcome by setting the item size as suggested.  
Note: Currently we are analyzing the possibilities and working internally to include this workaround in our source level without doing any extra effort in sample. We will let you know once it has been achieved in source level. 
We are requesting you to use the above suggestion. Please let us know if you are facing any issue or practical difficulties in the above suggestion that will help us to provide more appropriate solution. 
Dinesh Babu Yadav 

AB Almis Baimpourntidis September 1, 2017 07:43 AM UTC

Thank you for your help and explaining the issue, I will look at your sample and try the workaround.

DB Dinesh Babu Yadav Syncfusion Team September 4, 2017 04:36 AM UTC

Hi Almis, 
Thanks for the update. We will wait to hear from you. 
Dinesh Babu Yadav 

Live Chat Icon For mobile
Up arrow icon