You can try creating a UserControl, which is basically an image inside the canvas, and set two transformation properties to control scaling and panning. ScaleTransform will handle the scaling, and TranslateTransform will handle the pan. You can create a CompositeTransform from both of them and assign it as a canvas RenderTransform.
You can bind the zoom slider to a ScaleTransform and handle mouse events to modify the TranslateTransform. For now, you get the mouse coordinates relative to the canvas itself, which should work (i.e. mouseEventArgs.GetPosition(canvas)
).
source share