简体   繁体   中英

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?

您还需要启用水平滚动(默认情况下关闭)

HorizontalScrollBarVisibility = "Auto"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM