For some reason, I am getting the assembly name for every time I am trying to bind to an Image. I am getting System.Windows.Control.Image in my TextBlock rather than the image itself.
My XAML looks like this
<TextBlock FontSize="16">
<TextBlock.Text>
<MultiBinding StringFormat=" {0} {1}">
<Binding Path="Icon"></Binding>
<Binding Path="Name"></Binding>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
And in my Model class, I am creating an Image like this:
public Image Icon
{
get
{
if (isFolder)
{
Image folderImage = new Image();
BitmapImage logo = new BitmapImage();
logo.BeginInit();
logo.UriSource = new Uri("pack://application:,,,/ComputerProject;component/Resources/FolderIcon.jpg");
logo.EndInit();
folderImage.Source = logo;
return folderImage;
}
else
{
return new Image(); //TODO
}
}
}
Can this be done in a TextBlock? I have tried using multiple textblocks rather than doing the StringFormatting but that didn't work either.