Pivot inside a ScrollViewer, scrollviewer wont scroll

前端 未结 2 1935
日久生厌
日久生厌 2021-01-24 03:49

I have a page that has many UI elements and its scrollable vertical like a Timeline. In the middle I have a pivot that when its gets focus or the mouse pointer enters the scroll

2条回答
  •  野的像风
    2021-01-24 04:36

    I found a solution but I hope there is a better way.

    Edit: Changed the division it makes it feel more like the the default scroll.

    private void PivotItem_PointerWheelChanged(object sender, PointerRoutedEventArgs e)
    {
        if (e.GetCurrentPoint(scrollViewer).Properties.MouseWheelDelta == (-120))
        {
            // On Mouse Wheel scroll Backward
            scrollViewer.ChangeView(null, scrollViewer.VerticalOffset + Window.Current.CoreWindow.Bounds.Height / 7, null, false);
        }
        if (e.GetCurrentPoint(scrollViewer).Properties.MouseWheelDelta == (120))
        {
            // On Mouse Wheel scroll Forward
            scrollViewer.ChangeView(null,scrollViewer.VerticalOffset - Window.Current.CoreWindow.Bounds.Height / 7, null, false);
        }
    }
    

提交回复
热议问题