public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (_imagesService == null)
_imagesService = ServiceLocator.Current.GetInstance<IImagesService>();
if (value is string)
{
BitmapSource imageSource = new BitmapImage();
Action sourceSetter = async () =>
{
var bytes = await _imagesService.ImageBytesFromUrl(value as string);
if(bytes != null)
imageSource.SetSource(new MemoryStream(bytes));
};
sourceSetter();
return imageSource;
}
else
return value;
}