AutoScroller
Auto-scrolls a ScrollViewer when something is dragged against its edge. Supports both UWP (Windows.UI.Xaml) and WinUI3 (Microsoft.UI.Xaml, Windows App SDK) apps from a single NuGet package.
Usage
Instantiate the AutoScroller with the target ScrollViewer. Set IsAutoScrollingEnabled to true to enable autoscrolling.
Set IsAutoScrollingEnabled to false before removing references to the AutoScroller. This will remove any event handlers that it set on the ScrollViewer.
Set AreTouchEventsHandled to true if you want it to respond to touch events. The default is false. Only do this if you have disabled the default ScrollViewer behaviour of panning in response to touch/drag interactions.
Set IsPointerCapturedOnPress to true if elements in the ScrollViewer don’t already capture the pointer. This is false by default. Setting this to true while other pointer captures are active might interfere with the existing captures. This scenario has not been tested.
Change the speed of scrolling by setting ScrollPixelsPerTick. It is the number of pixels scrolled per tenth of a second when autoscrolling is occurring. The default value is 20.
Platform support
The package targets both uap10.0.17763 (UWP) and net8.0-windows10.0.19041.0 (WinUI3 / Windows App SDK). NuGet resolves the correct build automatically based on your project’s target framework - the API is identical on both platforms. WinUI3 projects need Microsoft.WindowsAppSDK referenced, as usual for any WinUI3 app.