Zooming into image in Windows Store apps

谁都会走 提交于 2019-12-10 14:52:22

问题


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?


回答1:


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

HorizontalScrollBarVisibility = "Auto"


来源:https://stackoverflow.com/questions/13229468/zooming-into-image-in-windows-store-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!