简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM