To reproduce:
- Zoom the diagram and drop an item from the toolbox.
Workaround:
Friend Class MyToolbox
Inherits RadDiagramToolbox
Protected Overrides Sub DragDropService_PreviewDragDrop(ByVal sender As Object, ByVal e As RadDropEventArgs)
'base.DragDropService_PreviewDragDrop(sender, e);
Dim shape = TryCast(GetType(RadDiagramToolbox).GetField("shape", System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance).GetValue(Me), RadDiagramShape)
Dim diagramElement As RadDiagramElement = TryCast(e.HitTarget, RadDiagramElement)
Dim containerShape As RadDiagramContainerShape = TryCast(e.HitTarget, RadDiagramContainerShape)
If containerShape IsNot Nothing Then
diagramElement = containerShape.FindAncestor(Of RadDiagramElement)()
End If
If diagramElement Is Nothing OrElse diagramElement.Shape IsNot Nothing OrElse shape Is Nothing Then
Return
End If
e.Handled = True
Dim zoom As Double = diagramElement.Zoom
Dim m As Telerik.WinControls.Layouts.RadMatrix = diagramElement.MainPanel.Transform
m.Invert()
Dim position = New Telerik.Windows.Diagrams.Core.Point(m.DX + (e.DropLocation.X - shape.Width \ 2) * 1 / zoom, m.DY + (e.DropLocation.Y - shape.Height \ 2) * 1 / zoom)
If containerShape IsNot Nothing Then
position.X += containerShape.Position.X
position.Y += containerShape.Position.Y
End If
shape.Position = position
diagramElement.AddShape(shape, Nothing, True)
If containerShape IsNot Nothing Then
DirectCast(containerShape, IContainerShape).AddItem(shape)
End If
shape = Nothing
End Sub
End Class