I am trying to set the WPF image source.
XAML works:
<Image Name="ImageThing" Source="images/Thing.png"/>
Visual Basic Error :
ImageThing.Source = "images/Thing.png"
& hellip; with this exception :
A value of type 'String' cannot be converted to 'System.Windows.Media.ImageSource'.
How do I create the System.Windows.Media.ImageSource I need?
Update
This code, adapted from the MSDN example , works:
Dim bmp As New BitmapImage() bmp.BeginInit() bmp.UriSource = New Uri("images/Thing.png", UriKind.Relative) bmp.EndInit() ImageThing.Source = bmp
Zack peterson
source share