开发者

Change number of lines mouse wheel scrolls in WPF ListBox

开发者 https://www.devze.com 2023-04-02 12:18 出处:网络
In a WPF listbox, rotating mouse wheel will scroll list by the number of lines specified in Windows Control Panel, in Mouse Wheel options.

In a WPF listbox, rotating mouse wheel will scroll list by the number of lines specified in Windows Control Panel, in Mouse Wheel options.

How can I change this, for example I want to scroll WPF ListBox, o开发者_开发技巧ne line anytime, using mouse wheel.

Thank you.


As you stated it is a control panel setting and you are trying to override it. That will confuse the user. I recommend you to not do that.

However you could try and override various events and position the vertical scrolling by using scrollViewer.ScrollToVerticalOffset(...);


As stated by ygoe in a comment, what you are looking for is :

ScrollViewer.CanContentScroll="False"

In my tests, it does scroll the list one line at a time.

Of course, you should consider that it overrides a global windows setting, as stated by Erno

0

精彩评论

暂无评论...
验证码 换一张
取 消