I have a canvas inside of a scrollviewer that allows me to zoom in and out of my canvas. I am trying to drag items from a listbox onto the canvas. I've been using some examples that I found online and in this forum. As longer as the user doesnt zoom, everything works as expected. However once the user zooms in or out, the items being dragged onto the canvas are randomly placed. Here is the pertinent code from my OnDropInfo method
How can I change this to make zooming work?
Point desiredPosition = new Point();
Point currentDragPoint = e.Options.CurrentDragPoint;
Point canvasPosition = this.TransformToVisual(null).Transform(new Point());
desiredPosition.X = currentDragPoint.X - canvasPosition.X;
desiredPosition.Y = currentDragPoint.Y - canvasPosition.Y;
How can I change this to make zooming work?