Skip to content

Commit

Permalink
Allow horizontal scrolling if the horizontal scrollbar is not disable…
Browse files Browse the repository at this point in the history
…d and the vertical scrollbar is disabled (#3174)

* Fixes #3170 - A horizontal scroll happens if the mouse has a horizontal wheel OR if the horizontal scrollbar is not disabled AND the vertical scrollbar IS disabled

* Only scroll opposite if the scroll happened from a horizontal scroll

* Correct or statement

Co-authored-by: Michael Hawker MSFT (XAML Llama) <michael.hawker@outlook.com>
  • Loading branch information
skendrot and michael-hawker authored Mar 24, 2020
1 parent 5e030db commit 469d951
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3712,7 +3712,10 @@ protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
if (!e.Handled)
{
PointerPoint pointerPoint = e.GetCurrentPoint(this);
bool isForHorizontalScroll = pointerPoint.Properties.IsHorizontalMouseWheel;

// A horizontal scroll happens if the mouse has a horizontal wheel OR if the horizontal scrollbar is not disabled AND the vertical scrollbar IS disabled
bool isForHorizontalScroll = pointerPoint.Properties.IsHorizontalMouseWheel ||
(this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled && this.VerticalScrollBarVisibility == ScrollBarVisibility.Disabled);

if ((isForHorizontalScroll && this.HorizontalScrollBarVisibility == ScrollBarVisibility.Disabled) ||
(!isForHorizontalScroll && this.VerticalScrollBarVisibility == ScrollBarVisibility.Disabled))
Expand All @@ -3721,7 +3724,7 @@ protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
}

double offsetDelta = -pointerPoint.Properties.MouseWheelDelta / DATAGRID_mouseWheelDeltaDivider;
if (isForHorizontalScroll)
if (isForHorizontalScroll && pointerPoint.Properties.IsHorizontalMouseWheel)
{
offsetDelta *= -1.0;
}
Expand Down

0 comments on commit 469d951

Please sign in to comment.