Set SelectedItem programmatically

Is there a way to set the current SelectedItem in a ListView with code ?

Yes you have a two options:

  • Select item by index: mylist.selectedIndex = 4 or mylist.selectedIndices = [0,2,7]
  • Select item by reference: mylist.selectedItem = item0 or mylist.selectedItem = [item0, item1]
2 Likes

Thanks for pointing them out @melMass, missed those for a couple of days.

1 Like