0

I'm using ScrollViewer control to zoom an image, I manage to set ZoomMode="Enabled" to enable the zooming function. But the problem is, it only works by holding Ctrl key and mouse wheel!

Is there any way to just using mouse wheel? Or change the other key?

My code:

<ScrollViewer
    ZoomMode="Enabled" 
    HorizontalScrollMode="Enabled" 
    VerticalScrollMode="Enabled" 
    HorizontalScrollBarVisibility="Auto"
    VerticalScrollBarVisibility="Auto">

    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
        <Image Source="aaa.jpg" />
    </Grid>
</ScrollViewer>
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Phap Duong Dieu
  • 164
  • 2
  • 7
  • This is the default behavior. Mouse wheel controls controls the scrolling of the content and Ctrl key + mouse wheel controls the scrollviewer's zoom. This is an internal design, if you want to change it, may be you could try to disable the ZoomMode and subscribe the PointerWheelChanged event. In the event, zoom the scrollviewer manually by calculating the zoomFactor. – Faywang - MSFT Jun 24 '20 at 06:17
  • Thanks @Faywang-MSFT for reply – Phap Duong Dieu Jun 24 '20 at 14:03

0 Answers0