I changed the code to make it work. I generated an own picture class:
Public Class PictureElement
Inherits FrameworkElement
Private _children As VisualCollection
Public Sub New(p_position As Point, ByVal Url As String)
PositionOnCanvas = p_position
_children = New VisualCollection(Me)
_children.Add(CreateDrawingVisualImage(Url))
End Sub
Private Function CreateDrawingVisualImage(ByVal img As String) As DrawingVisual
Dim imgConv = New ImageSourceConverter()
Dim imageSource As ImageSource
imageSource = DirectCast(imgConv.ConvertFromString(img), ImageSource)
Dim imgHeight = imageSource.Height
Dim imgWidth = imageSource.Width
Dim drawingVisual As New DrawingVisual()
Dim drawingContext As DrawingContext = drawingVisual.RenderOpen()
drawingContext.DrawImage(imageSource, New Rect(0, 0, imgWidth, imgHeight))
drawingContext.Close()
Return drawingVisual
End Function
......
Would love to know how to do it with my original method though....