0
我正在从WP7中获取联系人。一些联系人有图像一些没有。我想显示那些没有图像的联系人的默认图像。从WP7中的图像返回DecodeJpeg
我用下面的图像转换器,
public class ContactPictureConverter : System.Windows.Data.IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Contact c = value as Contact;
if (c == null) return null;
System.IO.Stream imageStream = c.GetPicture();
if (null != imageStream)
{
return Microsoft.Phone.PictureDecoder.DecodeJpeg(imageStream);
}
else
{
return null;
}
}
在如果的ImageStream是空的话,我想回到我的默认图像。
如何做到这一点?
谢谢Nasenbaer ......它的工作好... :-) – Ponmalar 2012-04-03 06:48:22