There are two types of focus in WPF: keyboard focus and logical focus. This link can provide you more information about focus in WPF.
You can do it:
ListViewItem item = myListView.ItemContainerGenerator.ContainerFromIndex(index) as ListViewItem; item.Focus();
You can also call
Keyboard.Focus(item);
If you also want to scroll the ListView to a position position, add this:
myListView.ScrollIntoView(item);
IMPORTANT NOTE: To do this, you need to set VirtualizingStackPanel.IsVirtualizing="False" on the ListView , which may lead to its slow execution. The reason this nested property is required is because when the ListView virtualized (by default it is), ListViewItems not created for items that are not displayed on the screen, which will cause ContainerFromIndex() to return null .
Adi lester
source share