user604613
user604613

Reputation:

Zooming into image in Windows Store apps

I have a ScrollViewer with an Image Control in it. It displays a rather large image. I want my user to be able to zoom into the image using gestures. I therefore enabled the ZoomMode on the Scrollviewer. However the Scrollviewer automatically scrolls back to the left "edge" of the image whenever the user releases its finger, making effectively zooming in and out of the image impossible.

This is the Template i am using:

<DataTemplate x:Key="SingleItemTemplate">
    <ScrollViewer ZoomMode="Enabled">
        <Grid Margin="5,0,5,0">
            <Image Source="{Binding ImageUrlHighRes}">
            </Image>
        </Grid>
    </ScrollViewer>
</DataTemplate>

How can i solve this problem?

Upvotes: 5

Views: 1580

Answers (1)

Jon Jarns&#228;ter
Jon Jarns&#228;ter

Reputation: 76

You need to enable the horizontal scrolling as well (turned off by default)

HorizontalScrollBarVisibility = "Auto"

Upvotes: 6

Related Questions