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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to automatically scroll to bring a selected item into the view?

Platform: Xamarin.Forms |
Control: SfListView

SfListView allows you to automatically bring the selected item into the view when it changed at runtime by calling the ScrollToRowIndex method. 


In linear layout, you can get the row index of SelectedItem using the DisplayItems.IndexOf method and adjust the index based on header and group header like below code snippets.



public partial class MainPage : ContentPage
  public MainPage()
    listView.PropertyChanged += listView_PropertyChanged;
  private void listView_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    if (e.PropertyName == "SelectedItem")
                var selectedItemIndex = listView.DataSource.DisplayItems.IndexOf(listView.SelectedItem);
                selectedItemIndex += (listView.HeaderTemplate != null && !listView.IsStickyHeader || !listView.IsStickyGroupHeader) ? 1 : 0;
                selectedItemIndex -= (listView.GroupHeaderTemplate != null && listView.IsStickyGroupHeader) ? 1 : 0;
                (listView.LayoutManager as LinearLayout).ScrollToRowIndex(selectedItemIndex);


Click here to download the sample.

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
You must log in to leave a comment
Mar 20, 2020

Is there a winforms version of this?

Farjana Parveen Ayubb [Syncfusion]
Mar 23, 2020

Hi Steve,

You can able to scroll the specific record in SfDataGrid by using SfDataGrid.TableControl.ScrollRows.ScrollInView method. Please refer the below KB document.


Regards, Farjana Parveen A

Darek Potchebout
Jun 22, 2020

I believe the question was, Is there a WinForms verion of this for the SfListView? Can the WinForm's version of the SfListView be programmatically scrolled to move the selected item into view?


Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile