I am referring this http://www.dotnetcurry.com/ShowArticle.aspx?ID=585 to retrieve image from sql server to window phone and had error ArgumentNullException was unhandled when run it at the that higlighted row.
public class ImageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
byte[] buffer = value as byte[];
**Stream memStream = new MemoryStream(buffer);**
WriteableBitmap wbimg = PictureDecoder.DecodeJpeg(memStream);
return wbimg;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return null;
}
}
I had found another similar post had same error with me.
http://forums.create.msdn.com/forums/p/74224/452127.aspx
But don’t understand the coding..Anyone know how to solve the error?
Looks like value is null or is not a byte array.