In my little app there’s a button that once getting clicked, the fifth item in the listview getting selected.
the problem is that its out of the listview scope and I would like the vertical scroll bar to slide down to the so I can see the selected item.
How can I do that ?

XAML:
<StackPanel>
<Button Click="Button_Click">Find number 5</Button>
<ListView x:Name="lst" ScrollViewer.VerticalScrollBarVisibility="Visible" Height="50">
<ListView.Items>
<ListViewItem>1</ListViewItem>
<ListViewItem>2</ListViewItem>
<ListViewItem>3</ListViewItem>
<ListViewItem>4</ListViewItem>
<ListViewItem>5</ListViewItem>
<ListViewItem>6</ListViewItem>
<ListViewItem>7</ListViewItem>
</ListView.Items>
</ListView>
</StackPanel>
C# code:
public partial class Window2 : Window
{
public Window2()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
((ListViewItem)lst.Items[4]).IsSelected = true;
}
}
Use ListView.ScrollIntoView to achieve what you want: