Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Load SVG from PCL by CODE USING FFImageLoading

$
0
0

Hello,

I'm using this package from nugget to display images in SVG :

https://github.com/luberda-molinet/FFImageLoading/wiki

I'm able to load images using xaml from PCL like this:

//using
xmlns:ffimageloadingsvg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms">

//my image from resources in PCL

<ffimageloadingsvg:SvgCachedImage WidthRequest="75" HeightRequest="93" Source="resource://MyProject.Resources.MenuLogo.svg" Margin="0,0,0,50" />

Also I'm able to load images by code from a URL like this:

              map = new SvgCachedImage()
                     {
                         DownsampleToViewSize = true,
                         DownsampleWidth = Width,
                         RetryCount = 0,
                         RetryDelay = 250,
                      Source = SvgImageSource.FromUri(new Uri("https://a/simple/web/formaps/1/12_Mapa_Path.svg"))
                     };

The problem happens when I try to load an image from PCL by code :

        var logo = new SvgCachedImage()
        {
            DownsampleToViewSize = true,
            DownsampleWidth = Width,

        };

I have tried to use different sources but:

Source = SvgImageSource.FromFile("MenuLogo.svg") // No errors but does not display anything

Source = Xamarin.Forms.ImageSource.FromResource("MenuLogo.svg")// Like if it was a normal loading but nothing is displayed

Source = SvgImageSource.FromResource("MyProject.Resources.MenuLogo.svg") // Cannot implicitly convert type 'FFImageLoading.Work.ImageSource' to 'Xamarin.forms.ImageSource'

I don´t know what I'm doing wrong, and I have not found any documentation to load PCL svg by code.

Anyone with the same problem or somebody could help me ?

Thankyou, sorry about my English :smiley:


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>