Article From:https://www.cnblogs.com/lonelyxmas/p/9688728.html
WPF: multi touch zoom in and out.

Copyright notice: This article is an original article for bloggers, which needs to be reprinted, though reproduced. Https://blog.csdn.net/z5976749/article/details/40118437

If you want to narrow down a canvas, or picture:

<Canvas x:Name="picShow" ClipToBounds="True" Canvas.Left="0" Canvas.Top="0" Height="509" Width="720">
        <i:Interaction.Behaviors>
            <ei:TranslateZoomRotateBehavior x:Name="eiPic" TranslateFriction="0.1" RotationalFriction="0.1"/>
        </i:Interaction.Behaviors>
        <Image x:Name="image1" Height="410" Canvas.Left="45" Source="" Canvas.Top="42" Width="629"/>
</Canvas>

Just add & lt; i: Interaction. Behaviors & gt; lt; ei: TranslateZoom Rotate Behavior /& gt; lt; / i: Interaction.Behaviors> you can stretch and change controls.

If you add this behavior in canvas, you can stretch all controls in canvas.

TranslateFrictionIt’s mobile friction. RotationalFriction is a rotating friction force.

eiPic.SupportedGestures = ManipulationModes.None;  //Control whether mobile

ManipulationModesIt also controls the movement direction and single direction movement of the control.

Link of this Article: WPF multi touch zoom in and down

Leave a Reply

Your email address will not be published. Required fields are marked *