/// <summary> /// Convert /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="parameter"></param> /// <param name="culture"></param> /// <returns></returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var str = value as string; if (string.IsNullOrWhiteSpace(str)) { return(null); } var xfSource = _imageSourceConverter.ConvertFromInvariantString(str) as ImageSource; //TODO Parse width / height eg. image.svg@SVG=0x200 where 200 is width return(new SvgImageSource(xfSource, 0, 0, true)); }
public override object ConvertFromInvariantString(string value) { var text = value as string; if (string.IsNullOrWhiteSpace(text)) { return(null); } var xfSource = _imageSourceConverter.ConvertFromInvariantString(text) as ImageSource; if (text.IsSvgFileUrl() || text.IsSvgDataUrl()) { return(new SvgImageSource(xfSource, 0, 0, true)); } return(xfSource); }
public object ConvertFromInvariantString(string value) { var imgConverter = new FFImageLoading.Forms.ImageSourceConverter(); var text = value as string; if (string.IsNullOrWhiteSpace(text)) { return(null); } var xfSource = imgConverter.ConvertFromInvariantString(value) as ImageSource; if (text.IsSvgFileUrl() || text.IsSvgDataUrl()) { return(new SvgImageSource(xfSource, 0, 0, true)); } return(xfSource); }