/// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var path = (string)value; var baseUri = context.GetContextBaseUri(); return(SvgSource.Load <SvgSource>(path, baseUri)); }
/// <inheritdoc/> public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { var s = (string)value; var uri = s.StartsWith("/") ? new Uri(s, UriKind.Relative) : new Uri(s, UriKind.RelativeOrAbsolute); var svg = new SvgSource(); if (uri.IsAbsoluteUri && uri.IsFile) { svg.Load(uri.LocalPath); return(svg); } var assets = AvaloniaLocator.Current.GetService <IAssetLoader>(); svg.Load(assets.Open(uri, context.GetContextBaseUri())); return(svg); }