ListView problem

  • Thread starter Thread starter alan
  • Start date Start date
A

alan

Hello,

Anyone know how to scroll down the listview by code?
Eg. I have 200 items in the listview. When I set the selectedItem to be
item 180, the user cannot see it if he don't scroll it down.

Thanks!
 
Use the EnsureVisible method. Pass in the index of the item you want to
scroll into view.
 
Hi Alan,

Thanks for posting in this group.
You can use ListView.EnsureVisible method to force listview auto scroll to
your wanted item.

If the item that you want to ensure is visible is located above the
viewable region of the ListView control, calling the EnsureVisible method
will scroll the contents of the control until it is the first item in the
viewable area of the control. If the item is below the viewable region of
the ListView control, calling the EnsureVisible method will scroll the
contents of the ListView control until the item is the last item in the
viewable area of the control.

Hope this helps,

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top