Query |
Response | |
Using ScrollTo method |
You can programmatically scroll to the specified ScrollY position using the ScrollTo method.
If your requirement is to scroll to a particular index then we would suggest you to use ScrollToRowIndex method. You can scroll to the desired index by passing the underlying data in DisplayItems.IndexOf method as like below code example.
Code Example[C#]:
Please refer the below documentation link to know more information.
Documentation link: https://help.syncfusion.com/xamarin/sflistview/working-with-sflistview#programmatic-scrolling
| |
Scrolling the list back to 1st item |
We could not understand your requirement clearly. Yet based on your query “Need to scroll to 1st index when particular index has reached”, we have created a sample to meet your requirement. In our sample we have used Changed event of ScrollAxisBase in VisualContainer to notify whether reached the particular item in the list has been reached based on LastBodyVisibleLineIndex property. By using Reflection you can get the VisualContainer from SfListView and use the same way to get ScrollAxisBase from VisualContainer.
When the particular index has been reached you can programmatically scroll to the first index as like below code snippets,
Code Example[C#]:
|