Live Chat Icon For mobile
Live Chat Icon

How do I move the focus to a ListViewItem that could also be out of view?

Platform: WPF| Category: ListView

You can do so as follows:

            this.myList.SelectedItem = o;
            // In case the item is out of view. If so, the next line could cause an exception without bringing this item to view.
            ListViewItem lvi = (ListViewItem)myList.ItemContainerGenerator.ContainerFromIndex(myList.SelectedIndex);

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.