You can show images in Silverlight using Image control. You can furthermore bind Source property of the image to byte[] type property of a business object. You would think this is sufficient, but it is not. You will need a converter to convert byte array into image source.
Here is the class for converter
public class ImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
BitmapImage bitmap = new BitmapImage();
bitmap.SetSource(new MemoryStream((Byte[])value));
return bitmap;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Here is how this class is used in a control:
<UserControl.Resources>
<helpers:ImageConverter x:Key="ConvertImage"/>
</UserControl.Resources>
<Image Source="{Binding Path=MyByteArrayPropertyName, Converter={StaticResource ConvertImage}}" />