What is the best way for Zooming the Image inside ScrollViewer in WPF and also other alternative methods to Zoom the Image.

Posted by Anwarcode under WPF on 3/17/2010 | Views : 11328 | Status : [Member] | Replies : 1
What is the best technique to implement zoom functionality to the Image inside the ScrollViewer in WPF. Please provide sample code and suggest website links where I can find sample code and more info about various ways to Zoom the image.

Regards,
Anwar




Responses

Posted by: Abhi2434 on: 3/17/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
If you want to zoom the whole image use this :

 <Grid>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<ScrollViewer Height="200" Grid.Row="0">
<Image Source="abhijitphoto.jpg">
<Image.RenderTransform>
<ScaleTransform ScaleX="{Binding ElementName=slider, Path=Value}" ScaleY="{Binding ElementName=slider, Path=Value}"/>
</Image.RenderTransform>
</Image>
</ScrollViewer>
<Slider x:Name="slider" Maximum="100" Grid.Row="1"/>
</Grid>


Very simple code.

www.abhisheksur.com

Anwarcode, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response