0

I am using http://christian-helle.blogspot.in/2011/01/multi-platform-mobile-development_19.html for creating a custom list view. In the existing sample it is not possible to pre set the selectedIndex of list view.

I have made few changes to the sample code and I am able to set the index and highlight it. but the problem is I am not able to set the scroll position to the highlighted item. I have tried to set scrollBar.Value = itemindex, but it is not reflecting on the custom list view.

rakesh kashyap
  • 1,418
  • 22
  • 41

1 Answers1

1

The simplest solution would be ListView.EnsureVisible.

private ListView listView1;

private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
  if (-1 < listView1.SelectedIndex) {
    listView1.EnsureVisible(listView1.SelectedIndex);
  }
}