0

i have WPF application and ListView. When add files into the ListView i can see only the first 10 items and when adding another files i can see only the Vertical Scroll Bar and i want when add files that the focus will be on the last item that added. So i try to Select the last item:

listview.SelectedIndex = lvPcapFiles.Items.Count - 1;

or

listview.SelectedItem = lvPcapFiles.Items.Count - 1;

But the first option only select the last item but the focus is still no there.

The second do nothing.

mark yer
  • 403
  • 6
  • 12

1 Answers1

0

You can use

 listview.SelectedIndex = lvPcapFiles.Items.Count - 1;
 listview.ScrollIntoView(listview.SelectedItem);

There are some articles for you. here

Community
  • 1
  • 1
zhangyiying
  • 414
  • 4
  • 15