Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Winforms: How can I programmatically display the last item in a C# listview when there are vertical scrollbars?

How can I programmatically display the last item in a C# listview when there are vertical scrollbars? I've studied every method associated with listviews and can't find anything.

like image 586
Auburnate Avatar asked Mar 05 '09 20:03

Auburnate


1 Answers

It's not actually easy/possible to scroll the list view. You need to tell the item to make sure it's visible.

var items = listView.Items;
var last = items[items.Count-1];
last.EnsureVisible();
like image 150
JaredPar Avatar answered Oct 01 '22 17:10

JaredPar