Horizontal scroll with shift + scrollwheel

Hello,

Can you tell me if there is a way to enable horizontal scrolling with the scroll wheel in the PDF viewer?

This is the same in acrobat, when not holding down the shift key the scroll wheel scrolls the document vertically. When holding down the shift key it scrolls horizontally.

Thanks!


3 Replies 1 reply marked as answer

DD Divya Dhayalan Syncfusion Team December 19, 2021 05:54 PM UTC

Hi Wouter, 
 
Based on the details you have provided; we understand that your requirement is to do horizontal scroll using control keys and mouse wheel. We are currently checking on this and we will update further details on 21st December 2021. 
 
Regards, 
Divya  



DD Divya Dhayalan Syncfusion Team December 21, 2021 05:55 PM UTC

Hi Wouter,   
 
On analyzed further, we have logged a feature request to provide support for horizontal scrolling with “shift + mouse wheel”. Currently, we do not have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. Based on our present commitments and the above parameters, we will implement the feature in any of our upcoming release.  
      
You can track the status of this feature request here: https://www.syncfusion.com/feedback/31382/support-for-horizontal-scrolling-in-pdfviewer  
 
Regards, 
Divya

Marked as answer

WV Wouter van der Post March 30, 2022 01:46 PM UTC

For anyone who wants this functionality:

I added 2 variables in the code behind:

    private double _horizontalOffset;
    private double _verticalOffset;

In the xaml I've added 2 event handlers to the PreviewMouseWheel and ScrollChanged events:

    <PdfViewer:PdfViewerControl Name="PdfViewerControl" PreviewMouseWheel="PdfViewerControl_PreviewMouseWheel" ScrollChanged="PdfViewerControl_ScrollChanged" />

The code behind for these events look like:

    private void PdfViewerControl_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
    {
      if (Keyboard.Modifiers == ModifierKeys.Shift)
      {
        var zoomFactor = PdfViewerControl.ZoomPercentage / 100d;
        PdfViewerControl.ScrollTo((_horizontalOffset + -e.Delta) / zoomFactor, _verticalOffset / zoomFactor);
        e.Handled = true;
      }
    }

    private void PdfViewerControl_ScrollChanged(object sender, ScrollChangedEventArgs args)
    {
      _horizontalOffset = args.HorizontalOffset;
      _verticalOffset = args.VerticalOffset;
    }

Loader.
Up arrow icon