I have my drop and drag working to drop object into Canvas wrapped in a ViewBox. The viewbox is scaling the canvas so that it displays the fill object on the screen.
My problem is that the coordinates within the canvas are no longer the same as the screen coordinates. I'm currently using below code from examples -
// Determine the drop point for the new UserControl.
Point canvasPosition = Camera1Canvas.TransformToVisual(
var userControlDesiredPosition =
X = e.Options.CurrentDragPoint.X - canvasPosition.X,
Y = e.Options.CurrentDragPoint.Y - canvasPosition.Y
// e.Options.CurrentDragPoint returns the absolute mouse position,
// that is why we have to transform the host canvas and subtract its position from the absolute mouse position.
userControl.TabIndex = Camera1Canvas.Children.Count;
And this code works just fine if I'm positioning object to the screen coordinates. I need to understand how to map those coordinates so that object is placed in the correct location inside the canvas inside of the viewbox.