0

I have a Xamarin Forms standard project and I would like to leverage svg's. Acording to the documentation I should be able to leverage an external assembly for referencing my files.

When loading from embedded resources, you can specify different assembly with following format: resource://FFImageLoading.Forms.Sample.Resources.sample.svg?assembly=[ASSEMBLY FULL NAME]

I created an .net standard library and marked all the svg files as embedded resources. I reference the external library but i am not seeing anything on the screen.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:ASHT"
             xmlns:ffimageloadingsvg="clr-namespace:FFImageLoading.Svg.Forms;assembly=FFImageLoading.Svg.Forms"
             x:Class="ASHT.MainPage">

    <ffimageloadingsvg:SvgCachedImage WidthRequest="200" HeightRequest="200" Source="resource://Xamarin.FontAwesome.amazon.svg?assembly=Xamarin.FontAwesome"/>

</ContentPage>

Am i doing something wrong?

Spook Kruger
  • 367
  • 3
  • 15

1 Answers1

0

It seems you have to load the assembly from the main executable. In other words in the main activity startup code just add a line like this. This forces the assembly to be loaded as part of the runtime and can then be accessed.

var FAweseome = typeof(Xamarin.FontAwesome.Initialise);

Initialise is just a class in my Library it does not do anything. Once you have loaded the library you can just use it as per the documentation.

Thanks to daniel-luberda for helping me clear it up. https://github.com/luberda-molinet/FFImageLoading/issues/982#issuecomment-375287918

Spook Kruger
  • 367
  • 3
  • 15