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
精彩评论