When I use either .ScrollToItem(newIndex)
or .selectedIndex = newIndex
the ListView
does not seem to update and highlight the indicated index/item.
What is the correct way to change the selected index of a ListView
in code?
Use case would be when adding new items to a list, and trying to focus them immediately.
Since you haven’t had another response I’ll take a guess. Maybe you need to .Refresh()
after updating?
Before applying the modifications to the list data, it checks that the list has valid data by calling this method:
private bool HasValidDataAndBindings()
{
return itemsSource != null && makeItem != null && bindItem != null;
}
Since you’re selecting your element before your list is completely ready, you could make sure that all those properties aren’t null, as that could be the source of your problem.