WPF ListView Show Selected Item

I want to show the selected item as a list automatically (it is impossible to show all the items without scrolling).

this.listView.SelectedIndex = 999; selects, of course, the element, but it does not show it.

what can i use for auto display?

Regards, jeff

+4
source share
3 answers

You can do it: -

listview.ScrollIntoView (listview.SelectedItem);

Scroll the WPF ListBox to the selected item set in the code in the view model

+7
source

This may help you, I'm not sure if this is what you are looking for, but brings the selected item into view and scrolls it for you if necessary.

  int selectedIndex = listView.Items.IndexOf((listView.SelectedItems[0])) listView.Items[selectedIndex].EnsureVisible(); 
0
source

All Articles