简体   繁体   中英

Dependency missing when using WritableBitmapEx

I've used nuget to download WriteableBitmapEx to my WP7 project

I can see it has added two refrences in my references folder of my project

I can't seem to find a way to add the dependency to my class though. here is the class:

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();
    }
}
}

WritableBitmapEx is not the same as WritableBitmapExtensions!

Please check here for the code for the WritableBitmapExtensions!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM