<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <Image Source="{Binding PreviewImage}" HorizontalAlignment="Stretch" x:Name="scaleImage" ManipulationDelta="scaleImage_ManipulationDelta_1" ManipulationStarting="scaleImage_ManipulationStarting_1" ManipulationCompleted="scaleImage_ManipulationCompleted_1" VerticalAlignment="Stretch" IsManipulationEnabled="True" RenderTransformOrigin="0.5,0.5" Stretch="Fill" > <Image.RenderTransform> <MatrixTransform> </MatrixTransform> </Image.RenderTransform> </Image> </ScrollViewer>
private void scaleImage_ManipulationDelta_1(object sender, ManipulationDeltaEventArgs e) { Matrix rectsMatrix = ((MatrixTransform)scaleImage.RenderTransform).Matrix; ManipulationDelta manipDelta = e.DeltaManipulation; Point rectManipOrigin = rectsMatrix.Transform(new Point(scaleImage.ActualWidth / 2, scaleImage.ActualHeight / 2)); rectsMatrix.ScaleAt(manipDelta.Scale.X, manipDelta.Scale.Y, rectManipOrigin.X, rectManipOrigin.Y); rectsMatrix.Translate(manipDelta.Translation.X, manipDelta.Translation.Y); ((MatrixTransform)scaleImage.RenderTransform).Matrix = rectsMatrix;// (MatrixTransform)(new MatrixTransform(rectsMatrix).GetAsFrozen()); e.Handled = true; } private void scaleImage_ManipulationStarting_1(object sender, ManipulationStartingEventArgs e) { e.ManipulationContainer = this; e.Handled = true; }
--
---
You received this message because you are subscribed to the Google Groups "XAML Disciples" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wpf-disciple...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.