views:

42

answers:

1

I have an image inside a scroll viewer and buttons to zoom in and zoom out. Now when the image is zoomed, i want to be able to click on the image and drag in any direction as if i was scrolling in those directions. How to do this? thanks.

+1  A: 

I posted a similar question here a while back. I was trying to do the same type of thing with a ScrollViewer and was able to get it to work, but it was definately limited. We used this control which worked great for us.

<zoom:ZoomControl x:Name="zoom" 
                  InitialZoom="1" 
                  Background="Blue" 
                  ZoomEnabled="True" 
                  PanEnabled="True" 
                  Height="400" 
                  Width="600" 
                  ZoomStep="1" 
                  MaxZoom="10" 
                  MinZoom="1">
    <StackPanel>
        <Button Content=" Test " Margin="20"/>
        <Image Source="C:\Documents and Settings\user\Desktop\IMG_5018.JPG" Height="50"/>
    </StackPanel>

</zoom:ZoomControl>
JSprang
Can you give me an example on how you made this control work? i can't seem to make it work. Thanks
Zee99
I can't give you any examples because we just used this as a prototype, then created something similar of our own (which I'm unable to share). I do remember that we had to set a couple properties in the XAML of that control to get it to work, they may have been IsPanningAllowed and IsZoomingAllowed. Sorry that I don't have more details for you, I was just hoping this could point you in a direction like it did for us.
JSprang
Can you just tell me how to load an image in this control? i tried to put an image as its content, but the control is always showing a black background and i am unable to load an image.
Zee99
Did you do it like this? <ZoomBox><Image/></ZoomBox>
JSprang
i tried this:<my:ZoomControl x:Name="ZoomControl1" Background="Black"><Image Source="/SilverlightApplication1;component/Images/BerlinTrainStation_ROW1919864054.jpg"></Image></my:ZoomControl>no success.
Zee99
I just opened up my prototype project and added an image to it, however, the image did not show up. In our implementation we have a user control inside of this, no images. I'm not exactly sure why the image will not show up, sorry about that. I have edited my post with some code showing my implementation (note: only the button is showing up for me, no image).
JSprang

related questions