Reputation: 133
I have canvas called "drawCanvas" to show images and inkcanvas that is contained in the canvas called "CanvasContainInkCanvas". I can zoom out by using MatrixTransform.
//Get the image that's being manipulation.
Canvas element = (Canvas)e.Source;
//Ues the matrix of the transform to manipulation the element's appearance.
Matrix matrix = ((MatrixTransform)drawCanvas.RenderTransform).Matrix;
//Get the ManipulationDelta object.
ManipulationDelta deltaManipulation = e.DeltaManipulation;
//Find the old center, and apply any previous manipulations.
Point center = new Point(element.ActualWidth / 2, element.ActualHeight / 2);
//Apply new move manipulation (if it exists).
center = matrix.Transform(center);
//Apply new zoom manipulation (if it exists).
matrix.ScaleAt(deltaManipulation.Scale.X, deltaManipulation.Scale.Y, center.X, center.Y);
//Translation (pan)
matrix.Translate(e.DeltaManipulation.Translation.X, e.DeltaManipulation.Translation.Y);
//Set the final matrix.
((MatrixTransform)drawCanvas.RenderTransform).Matrix = matrix;
// set the matrix of canvas that contain inkcanvas
((MatrixTransform)CanvasContainInkCanvas.RenderTransform).Matrix = matrix;
If I zoom out, I can see images outside canvas.
I want to copy images from canvas to inkcanvas to use selection. My problem is that the images cannot be shown outside inkcanvas.
How do I show images outside inkcanvas?
Thanks
Update: How do I use selection outside inkcanvas?
Upvotes: 0
Views: 881
Reputation: 30830
Set ClipToBounds="False"
on that InkCanvas
. By default it's set to True
.
Upvotes: 2