View selected item in listView

  • Thread starter Thread starter Alberto
  • Start date Start date
A

Alberto

I select an item in a listView by code and it works fine (thanks to Morten
Wennevik who tell me how to do it) but if the item is out of screen (there
are a lot of items) I'd like to see it selected. Actually, the item is
selected but I can't see because is out of screen.

Thank you.
 
Hi Alberto,

Add EnsureVisible(lst.FocusedItem.Index); to each key in the switch.

....
lst.EnsureVisible(lst.FocusedItem.Index);
e.Handled = true;
break;
....
 
Back
Top