Это близко, но нужно немного больше работы. Сначала код, вам нужна реализация IValueConverter: -
public class PhotoConverter : IValueConverter
{
private BitmapImage PhotoConvert(string value)
{
BitmapImage bi = null;
if (!String.IsNullOrEmpty(value))
{
byte[] imageBytes = Convert.FromBase64String(value);
bi = new BitmapImage();
bi.SetSource(new MemoryStream(imageBytes));
}
return bi;
}
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return PhotoConvert((string)value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
Теперь вам нужно сделать экземпляр этого конвертера доступным в Xaml, хорошим местом будет словарь ресурсов UserControls: -
<UserControl ...Usual set of xmlns here...
xmlns:utils="clr-namespace:SL3Demo.Utility;assembly=SL3Demo">
<UserControl.Resources>
<utils:PhotoConverter x:Key="PhotoConverter" />
</UserControl.Resources>
Затем в вашем изображении: -
<Image x:Name="EmpPic"
Source="{Binding Photo, Converter={StaticResource PhotoConverter} }"
HorizontalAlignment="Center" Width="165" Height="160" Margin="2,2,2,2"/>