namespace GDNXFD.Alert.Config.Converters
{
using System;
using System.IO;
using System.Windows.Data;
using System.Windows.Media.Imaging;
///
/// Byte to image converter
///
public class ByteToImageConverter : IValueConverter
{
///
/// Convert a byte array to an image.
///
///
///
///
///
///
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value != null)
{
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = new MemoryStream((byte[])value);
bi.EndInit();
return bi;
}
return null;
}
///
/// Convert an image to a byte array
///
///
///
///
///
///
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}