I'm trying to make my scrollviewer zoom work. Without ZoomMaxFactor and ZoomMinFactor it is working great, but no limits for zoom. So i added the properties ZoomMaxMinFactor and my image are resizing without any interaction, i already looked for an answer but got nothing.
My XAML:
<PivotItem Header="item 1" >
<StackPanel x:Name="MyPanel" Width="360" Height="460">
<ScrollViewer Width="360" Height="460" ZoomMode="Enabled"
VerticalScrollBarVisibility="Visible"
HorizontalScrollBarVisibility="Visible"
MaxZoomFactor="0.5" MinZoomFactor="0.5">
<Image x:Name="MyCoolImg"/>
</ScrollViewer>
</StackPanel>
</PivotItem>
And code behind:
protected async override void OnNavigatedTo(NavigationEventArgs e)
{
MyCoolImg.Source = (BitmapImage)e.Parameter;
}
Thanks for your time =)
I got it,
New XAML:
<PivotItem Header="item1" >
<Grid Grid.Row="1">
<ScrollViewer Width="360" Height="470" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" ZoomMode="Enabled" MinZoomFactor="0.9" MaxZoomFactor="2.8">
<StackPanel>
<Image Width="360" Height="470" x:Name="myCoolImg" Stretch="Uniform" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</StackPanel>
</ScrollViewer>
</Grid>
</PivotItem>
Thanks for the help Kennyzx!
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.