2

Should you set VirtualizingPanel.ScrollUnit="Item" to a ListBox, what's the fastest way to get said ListBox to ignore the windows-settings set number of items to scroll (defaulted at 3) and instead just scroll one item at a time?

My first instinct Is to expect to have to catch the mousewheel with a PreviewMouseWheel event and then in code track the ScrollViewer delta (similar to implementing horizontal scrolling as explained here and here) and just tell it to go LineUp / LineDown, but I just want to make sure i'm not missing anything obvious / a less fiddly way of achieving this (even if the answer is "no" i'm happy to accept that).

Community
  • 1
  • 1
Logan
  • 806
  • 8
  • 17
  • Why scrolling more than one item is bad? Because you want or is there a problem? I didn't even know wheels scrolls by 3 items because I never noticed that. My guess user preferences are better to respect. – Sinatr Jul 08 '16 at 13:04
  • 1
    You can create inherited scrollviewer that will override mousewheel and change verticaloffset. I think you're not missing anything and changing of offset is the common way of doing something with scrollviewer – Mikolaytis Jul 08 '16 at 13:37
  • @Sinatr There's no drastic or specific problem, it's more of a UX based thing than anything 'wrong' really. That and a few of our lists have very large items and small listboxes that can only fit 3, 4 or 5 of said items on them at any one time so it can get a bit disorienting when everything you can see on a list disappears and is replaced by new content. The second or so it takes for a user reassess what they're looking at is a second I'd rather they not have to spend at all. – Logan Jul 08 '16 at 13:49
  • 1
    http://stackoverflow.com/questions/23144802/item-by-item-scrolling-in-a-wpf-listview – cdmnk Jul 08 '16 at 13:52
  • Voting to close my question as the question @cdmnk linked worked perfectly. Thanks everybody. – Logan Jul 11 '16 at 10:36

0 Answers0