I could not find the answer to this question.
I have a database in which there are paths to it ("images / myimage.jpg"). These images exist on my asp.net site, where I also host SL. I want to bind these images to a ListBox control so that the image is displayed.
I read that since I have a string value, "images / myimage.jpg", I need to convert it to a BitMap image. I have done this:
xaml:
<Image Source="{Binding ImageFile, Converter={StaticResource ImageConverter}}"/>
ImageConverter Class:
public object Convert(object value, Type targetType,
object parameter, CultureInfo culture)
{
try
{
Uri source= new Uri(value.ToString());
return new BitmapImage(source);
}
catch(Exception ex)
{
return new BitmapImage();
}
}
I get an error when creating the URI, "The format of the URI cannot be determined." What am I doing wrong? If I create a Uri that looks like this: http: // localhost: 49723 / images / myimage.jpg , it works fine.
"images/myimage.jpg" ?