Forum Discussion

hacka87's avatar
hacka87
Contributor
5 years ago
Solved

How to Scroll in a Xamarin.Forms.ListVIew ?

Hello !   I am trying to scroll to the bottom of the ListView.   Using the TouchItemXY(index, X, Y) automatically scrolls to the item specified by the index. There is one case when the Scro...
  • IStaroverov's avatar
    5 years ago

    Hi
    You can use this code
    function Test()
    {
      let listview = Mobile.Device()...XFObject("listView")
      let item = listview.ItemsSource.Item(0).Item(10) // e.g.11th item in a first group
      let position = 0 //Scroll to make a specified list item visible.
      listview.ScrollTo(item, position, true)
    }
    or
    function Test()
    {
      let listview = Mobile.Device()...XFObject("listView")
      for (let i = 0; i < listview.ItemsSource.Item(0).Count; i++)
      {
        let item = listview.ItemsSource.Item(0).Item(10)
        if (item.FullName == "Item 11")
          listview.ScrollTo(item, 0, true)
      }
    }