我已经使用nuget将WriteableBitmapEx下载到我的WP7项目
我可以看到它在我项目的references
文件夹中添加了两个引用
我似乎无法找到将依赖项添加到我的类中的方法。这是班级:
namespace Microsoft.Samples.CRUDSqlAzure.Phone.Converters
{
using System;
using System.Windows.Data;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows;
public class ImageByteConverter : IValueConverter
{
/// <summary>
/// Converts a Jpeg byte array into a WriteableBitmap
/// </summary>
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
byte[] val = (byte[])value;
MemoryStream ms = new MemoryStream(val);
return WriteableBitmapExtentions.DecodeJpeg(ms);
}
/// <summary>
/// Converts a WriteableBitmap into a Jpeg byte array.
/// </summary>
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;
WriteableBitmap wb = (WriteableBitmap)value;
return wb.EncodeJpeg();
}
}
}
答案 0 :(得分:2)
WritableBitmapEx与WritableBitmapExtensions不同!
请检查here以获取WritableBitmapExtensions的代码!