HandyOrg / HandyOrg/HandyControl
ScrollToVerticalOffsetWithAnimation doesn't work properly.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
This function always plays the animation from where the last animation ended rather than the actual starting point.
Suppose the last animation ended at HorizontalOffset 100. If I drag the ScrollBar to change the HorizontalOffset to 200, when I invoke the function again the animation will begin from 100 rather then from 200.
I went through the source code for ScrollViewer and found that this function plays animates by controlling CurrentHorizontalOffset. But this is an internal value and is set only when the function has been invoked. If the HorizontalOffset is changed in some other way, this value will not be changed.
As a result, the animation that this function plays always starts at the end of the last animation rather than the actual starting point.
Steps to reproduce the bug
- Create a new ScrollViewer and name it myscrollviewer.
- Create a new button and create the following handler.
private void button_Click(object sender, RoutedEventArgs e) { myscrollviewer.ScrollToHorizontalOffsetWithAnimation(200, 1000); } - Launch the window and drag the HorizontalScrollBar some distance to the right.
- Click the button and you will find that the starting point of the animation is incorrect.
Expected behavior
The animation should begin from the actual position of the ScrollBar to the end position.
It may be useful to add an argument to the function to sets the starting point of the animation.
Screenshots

NuGet package version
HandyControl 3.3.0
IDE
Visual Studio 2022
Framework type
.Net Framework 4.8
Windows version
May 2021 Update (19043)
Additional context
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ScrollToHorizontalOffsetWithAnimation and the ScrollViewer implementation described in the report; trace how CurrentHorizontalOffset is set and how scrollbar changes update the actual offset. Reproduce the sequence with the provided button handler, then verify that a new animation begins at the scrollbar's current position rather than the previous animation endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100