How to image zoom on ManipulationOrigin with LayoutTransformation and scrollviewer (WPF C#)

40 Views Asked by At

I'm working in a WPF project where I have to zoom an image, hence scrollviewer is needed when the image is zoomed.

I have achieved the zoom with delta manipulation matrix etc.

The problem is, using RenderTransform, scrollviewer doesn't work because i'm guesssing it assumes the position/layout never change. But when I use LayoutTranform, the scrollviewer works fine, but I can't zoom to the mouse position (ManipulationOrigin).

Is there a way I can achieve image zoom to ManipulationOrigin with LayoutTransformation and scrollviewer (WPF C#)

With this code:

ImageCanvas.RenderTransform = new MatrixTransform(matrix);

scrollviewer doesn't work, but image manipulation to mouse position / ManipulationOrigin work fine.

But with this code:

ImageCanvas.LayoutTransform = new MatrixTransform(matrix);

scrollviewer works fine but image manipulation to mouse position / ManipulationOrigin doesn't work.

Basically, I need both scrollviewer and image manipulation to mouse position to work.

0

There are 0 best solutions below