I\'m trying to set a WPF Image\'s source.
XAML works:
<
It can be even easier than the above:
ImageThing.Source = New BitmapImage(New Uri("images/Thing.png", UriKind.Relative))
What about
Private Sub Google_Click(sender As Object, e As RoutedEventArgs)
Mainbrowser.Navigate("http://www.contoso.com")
WPF uses an implicit type converter to convert the xaml string to the expected type. In code you are statically bound by the object type... If you look at the example here it shows how to set the source property to a BitmapImage that is generated from a local uri programatically.
Just change xaml file like this.
<Image Name="ImageThing">
<Image.Source>
<BitmapImage UriSource="images/Thing.png" />
</Image.Source>
</Image>
you will probably need to do something like this
Uri i = new Uri("images\\Thing.png");
keep in mind that you need to use a \ not a / for a windows file system
Take a look here