Miro
Miro

Reputation: 1806

Scroll ListBox up and down in code-behind

I can't find a ListBox methods for scrolling. I've found that ListBox itself implements ScrollView but I couldn't find LineUp() nor LineDown() method. Does ListBox have methods for scrolling ?

I need to attach this methods to buttons.

Upvotes: 2

Views: 2770

Answers (1)

Dana Cartwright
Dana Cartwright

Reputation: 1576

Scrolling in WPF (for all controls that implement it) is done with the ScrollViewer. See the accepted answer in WPF ListBox control horizontal scrolling in code for how to find the ScrollViewer of your ListBox. Then you can use ScrollViewer's LineUp()/LineDown() methods or a whole host of methods on it.

Upvotes: 1

Related Questions