You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Have the ScrollViewer take into account the Delta value when responding to mousewheel events #5936
At the moment, the WPF ScrollViewer always scrolls a fixed amount in response to mouse wheel events despite MouseWheelEventArgs returning the Delta value (The value that Windows sends as part of mouse wheel scrolling messages that determines how fast content should scroll.) Because of this, scrolling with precision scrolling devices such as touchpads scrolls ridiculously fast, making scrolling with devices like touchpads pretty much useless.
If the ScrollViewer could respond properly to the MouseWheelEventArgs.Delta value (i.e. scroll an appropriate amount depending on the delta value, which is just an integer), this would make scrolling in WPF so much better and greatly improve the user experience.
Reacted by lindexi, Bastian Schmidt, theoractice, Jan Kučera, Christian Lindenau, Daniel Chalmers, Damian, Fabio Fernandez, Botchaso, Yaroslav Bugaria and 11 more
Some code that can be used on the PreviewMouseWheel event of a ScrollViewer to enable a smoother scrolling experience, not sure if there's a better way to do this:
private void ScrollViewer_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
// Try catches here just to ensure app does not crash and instead falls back to default WPF scrolling behaviour if an exception occurs here for whatever reason
try
{
// Disables custom scroll handling when scroll by one screen at a time is enabled in mouse settings. Feel free to handle this yourself if you wish.
if (System.Windows.Forms.SystemInformation.MouseWheelScrollLines == -1)
e.Handled = false;
else
try
{
// Scrolls the scroll viewer according to the delta value and the user's scrolling settings
System.Windows.Controls.ScrollViewer SenderScrollViewer = (System.Windows.Controls.ScrollViewer)sender;
SenderScrollViewer.ScrollToVerticalOffset(SenderScrollViewer.VerticalOffset - e.Delta * 10 * System.Windows.Forms.SystemInformation.MouseWheelScrollLines / (double)120);
e.Handled = true;
}
catch
{
}
}
catch
{
}
}
I would very much like to have this implemented. Scrolling on Windows Precision touch pads (i.e. on practically every laptop on the market for the past couple years) is currently pretty much unusable on WPF.
Reacted by lindexi, aquinn39, Maximilian Haru Raditya, Victor Chelaru and Sven Koch
Activity
aquinn39 commentedon Feb 15, 2023
This seems to be the issue causing this: #3545
aquinn39 commentedon Feb 15, 2023
Some code that can be used on the PreviewMouseWheel event of a ScrollViewer to enable a smoother scrolling experience, not sure if there's a better way to do this:
DanielRouxSA commentedon Sep 8, 2023
I would very much like to have this implemented. Scrolling on Windows Precision touch pads (i.e. on practically every laptop on the market for the past couple years) is currently pretty much unusable on WPF.
SVNKoch commentedon Nov 3, 2024
Over a year later and this is still a major issue on basically all laptops :(
fix(scroll): 轻拨翻整页的真因是 WPF/WinForms 无视 delta,摊帧被当成多次滚动(v1.5.8)
fix(ui): 设置页改成按像素滚动;蓝底按钮白字被隐式样式吃掉(v1.6.2)