Skip to content

Commit 469d951

Browse files
Allow horizontal scrolling if the horizontal scrollbar is not disabled 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) <[email protected]>
1 parent 5e030db commit 469d951

File tree

1 file changed

+5
-2
lines changed
  • Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid

1 file changed

+5
-2
lines changed

Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/DataGrid.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3712,7 +3712,10 @@ protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
37123712
if (!e.Handled)
37133713
{
37143714
PointerPoint pointerPoint = e.GetCurrentPoint(this);
3715-
bool isForHorizontalScroll = pointerPoint.Properties.IsHorizontalMouseWheel;
3715+
3716+
// 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
3717+
bool isForHorizontalScroll = pointerPoint.Properties.IsHorizontalMouseWheel ||
3718+
(this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled && this.VerticalScrollBarVisibility == ScrollBarVisibility.Disabled);
37163719

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

37233726
double offsetDelta = -pointerPoint.Properties.MouseWheelDelta / DATAGRID_mouseWheelDeltaDivider;
3724-
if (isForHorizontalScroll)
3727+
if (isForHorizontalScroll && pointerPoint.Properties.IsHorizontalMouseWheel)
37253728
{
37263729
offsetDelta *= -1.0;
37273730
}

0 commit comments

Comments
 (0)