Beispiel #1
0
        /// <inheritdoc/>
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            var path    = (string)value;
            var baseUri = context.GetContextBaseUri();

            return(SvgSource.Load(path, baseUri));
        }
Beispiel #2
0
        /// <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)
            {
                var document = SM.SvgModelExtensions.Open(uri.LocalPath);
                if (document is { })