tags:

views:

54

answers:

3

Hi I want to scroll the items on the listview on the event of a button clik.is there any funtion on .Net(Windows Application) for this?

A: 

Hi,

are you talking about the WPF Listview? Then the following methods may help you:

ListView.BringIntoView ListView.ScrollIntoView

You can find information about these methods at:
http://msdn.microsoft.com/en-us/library/system.windows.controls.listview_members.aspx

Or you could set the property SelectedIndex, e.g.:
ListView.SelectedIndex = ListView.SelectedIndex + 1;

The last possibility i can imagine is to make the mousewheel-event of the listview fire, but i guess this is not recommended because WPF-Controls are lookless...

Ashwani Mehlem
Thank you for your reply.But my system is a Touch Screen system on a shop.There is no mouse.Every thing is doing by fingure.Also im not using WPF, :(
Binu
Also By chnging the selected index i could chnge the selected index,but the listview is not scrolling :(
Binu
A: 

The most popular way is SendKeys Method. You must set a focus to your ListView and use SendKeys method. Then you can return focus to the button.

Stremlenye
A: 

Something like this should work in WinForms:

ListView1.Items(newIndex).EnsureVisible()

You'd have to calculate newIndex so that it scrolled a suitable amount of rows.

ho1