ListView How to focus an item??

  • Thread starter Thread starter TN
  • Start date Start date
T

TN

I have a listview, i was wondering how can I focus an item in it? I am
updating a GUI periodically and clearing the view, so it loses focus, I
need a way to set this but can't find the right property.
 
TN said:
I have a listview, i was wondering how can I focus an item in it? I am
updating a GUI periodically and clearing the view, so it loses focus, I
need a way to set this but can't find the right property.

Hi TN,

Use ListView.EnsureVisible(int index) to force a certain ListViewItem to
become Visible.
 
I have a listview, i was wondering how can I focus an item in it? I am
updating a GUI periodically and clearing the view, so it loses focus, I
need a way to set this but can't find the right property.

You can use SelectedItem (or SelectedIndex) to mark it as selected and
then use EnsureVisible (you can use ListView.SelectedIndices[0] ) to
know which item is selected
 
Back
Top