I have a ScrollViewer that has an items source. The number of items in this could number in the tens of thousands and are streamed from the web server. We already are setting these two properties:
VirtualizingStackPanel.VirtualizationMode="Recycling" ScrollViewer.IsDeferredScrollingEnabled="True"
These work perfectly fine for dragging the thumb (button in the middle of the scroll bar) around, but when a user holds down the down arrow or clicks and holds down on the DecreaseRepeatButton or IncreaseRepeatButton (the invisible buttons above and below the thumb), the deferred scrolling is no longer respected and items scroll into view and chew through server resources.
What I would like to do is two fold:
1) Use deferred scrolling for the down/up arrows. In the absence of this we can increase the delay of the repeat button so holding down the button doesn’t continuously scroll.
2) Update the LargeChange of the Decrease/Increase repeat button so the user is scrolling 10% each time.
I have already tried descending down the visual tree for “PART_VerticalScrollBar” and setting LargeChange on the System.Windows.Controls.Primitives.ScrollBar to no avail.
I can hook into the property of the scroll bar and the thumb position is updated but then I can no longer drag the thumb.
Any help would be greatly appreciated.
I got it to work with a control template. It still looks janky as hell, but it works.
I then apply the template dynamically in the code behind by getting the PART_VerticalScrollBar and setting it like so: