Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have combobox with value 10%,25%,50%,100%,125%, on selection i want to zoom image. How can I do this?

here is my xaml for image, and i hvae combobox with values. how to do this

thanks.

What I have tried:

XML
<pre><ScrollViewer x:Name="ImgScroll" Grid.Column="0" Margin="5" Background="White" >
                    <ScrollViewer.Style>
                        <Style TargetType="{x:Type ScrollViewer}">
                            <Setter Property="HorizontalScrollBarVisibility" Value="Disabled"/>
                            <Setter Property="VerticalScrollBarVisibility" Value="Disabled"/>
                        </Style>
                    </ScrollViewer.Style>
                    <Border x:Name="ViewedPhotoArea" Padding="4" Margin="4" Background="White" BorderBrush="#22000000" BorderThickness="0" Visibility="Visible" ClipToBounds="True" >
                        <Border.RenderTransform>
                            <TranslateTransform 
                            X="{Binding HorizontalOffset}" 
                            Y="{Binding VerticalOffset}" />
                        </Border.RenderTransform>

                        <Image  x:Name="imgCurrent"
                                Margin="50"  RenderTransformOrigin="0.5, 0.5" IsManipulationEnabled="True"  
                                RenderOptions.BitmapScalingMode="HighQuality" RenderOptions.EdgeMode="Aliased" >
                            <Image.LayoutTransform>
                                <TransformGroup>
                                    <ScaleTransform x:Name="ScaleTrans" />
                                </TransformGroup>
                            </Image.LayoutTransform>
                            <Image.Effect>
                                <DropShadowEffect BlurRadius="20" ShadowDepth="0" Opacity="0.8"   Color="Black" />
                            </Image.Effect>
                        </Image>
                    </Border>
                </ScrollViewer>
Posted
Updated 10-Dec-17 22:42pm
v2

1 solution

 
Share this answer
 
Comments
Member 11859517 11-Dec-17 5:09am    
Thanks for reply,
I don't want to create any custom control. i want just want to zoom. like scale transform.
Member 11859517 11-Dec-17 5:31am    
thanks,
I am able to zoom on mouse wheel,
if (e.Delta > 0)
{
if (count < 3)
{
this.ScaleTrans.ScaleX += e.Delta * 0.002;
this.ScaleTrans.ScaleY += e.Delta * 0.002;

count++;
}

}
else if (e.Delta < 0)
{
if (count > 0)
{
this.ScaleTrans.ScaleX += e.Delta * 0.002;
this.ScaleTrans.ScaleY += e.Delta * 0.002;
count--;
}
}
ViewedPhotoScroll.ScrollToHorizontalOffset(ViewedPhotoScroll.HorizontalOffset);
ViewedPhotoScroll.ScrollToVerticalOffset(ViewedPhotoScroll.VerticalOffset);

but how to do on combobox selection % value do you have any idea.
Richard MacCutchan 11-Dec-17 6:09am    
Exactly the same. Take a value from the combobox (whatever you have stored in it) and adjust the scale factor to the required value or percentage.
Member 11859517 11-Dec-17 6:13am    
I tried that, but here mouseWheel event handler have e.data but fof combobox selection change will not have e.data.
and how i can pass the value of combobox. here e.Delta * 0.002

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900