I have a hard coded Image Source defined like this (the image is located in a file):
<Image Source="C:\Work\my_image.png"/>
The image is shown, all works. But now I would instead like to bind this Image Source. I tried like this:
<Image Source="{Binding ImageFilename}"/>
And
public class DataStuff
{
public string ImageFilename { get; set; }
public DataStuff(string imageFilename)
{
ImageFilename = imageFilename;
}
}
And
public MainWindow()
{
InitializeComponent();
DataContext = new DataStuff(@"C:\Work\my_image.png");
}
But the image is not shown.
What am I missing?