Is it possible to adjust mouse wheel scroll distance on a WPF ScrollViewer?

爷,独闯天下 提交于 2019-12-13 15:39:23

问题


I find it is scrolling too much at a time when the mouse scroll wheel is used. I have a very short ScrollViewer (one line tall) that contains a few lines of items in a WrapPanel, and it is scrolling right to the bottom in one "tick" so that the middle line is never visible.


回答1:


Not nice solution but you could add a few panes with text - one panel each line

ScrollViewer class uses IScrollInfo interface and there are 2 methods.

((IScrollInfo)myPanel).LineUp();// and LineDown()

Add a method to UIElement.MouseWheel event and one rotation == one children of a panel.

...or you could use:

 myScrollviewer.ScrollToVerticalOffset(offset);


来源:https://stackoverflow.com/questions/3358962/is-it-possible-to-adjust-mouse-wheel-scroll-distance-on-a-wpf-scrollviewer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!