I simplified @ColinE's solution. Instead of connecting to the ScrollBar.ValueChanged event, I am connecting to the ScrollViewer.ScrollChanged event. So, 1. there is no need to find the ScrollBar in the visual tree, and 2. ScrollBar.ValueChanged is called in some transition states when the contents of the ScrollViewer change, and I do not want to catch these states.
I am posting my code for VerticalOffset , HorizontalOffset is like:
And use it in XAML:
<ScrollViewer local:ScrollViewerBinding.VerticalOffset="{Binding ScrollVertical}"> </ScrollViewer>
source share