When the Image's Source property is set the following way, the picture is taken from /Images/down.png
.
How would I do the same thing programmatically?
<Image x:Name="myImg" Source="/MyProject;component/Images/down.png" />
The following would not work, since Image.Source property is not of a string type.
myImg.Source = "/MyProject;component/Images/down.png";
Try this:
BitmapImage image = new BitmapImage(new Uri("/MyProject;component/Images/down.png", UriKind.Relative));