/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <returns></returns> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string s) { if (ImageReference.TryParse(s, out var imageReference)) { return(imageReference); } } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// /// </summary> /// <param name="context"></param> /// <param name="culture"></param> /// <param name="value"></param> /// <returns></returns> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = value as string; if (s != null) { ImageReference imageReference; if (ImageReference.TryParse(s, out imageReference)) { return(imageReference); } } return(base.ConvertFrom(context, culture, value)); }