FFImageLoading - display pictures stored in shared assembly
I already talk about the really convenient and powerful lib FFLoadingImage for Xamarin Forms (here: FFLoadingImage for Xamarin Forms (quick overview)).
This library gives you a lot of tools to display and manage your application's pictures.
Loading pictures from a shared assembly
You can load pictures from different sources like:
- an HTTP Url
- An iOS or Android embedded resource picture. In this case you will need to duplicate the pictures for each specific platform project.
But did you know that you can also load images from a custom assembly like a SHARED Xamarin Forms assembly ?
It's pretty simple:
Set your picture's build action to: Embedded Resource
Shared assembly containing your pictures |
Then use the following syntax
In your xaml file where you want to display the picture, just use the following syntax. FFLoadingImage library will do the rest to load and display correctly images for each native platforms:
Pretty easy no ? :)<FFimg:CachedImagex:Name="uiLogoImage"DownsampleToViewSize="true"Source="resource://MyProject.Assets.Pictures.Image1.png"VerticalOptions="Center"WidthRequest="26"/>
Comments
Post a Comment