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

Load a FileImageSource from an embedded resource

$
0
0

The XAML Button has an Image property which can be loaded with an image bundled with each OS version. This is not helpful for cross-platform development with hundreds of images. Can this image be loaded from an Embedded resource in the same way an Image Source can be set.

The following works great

<Image Source="{local:ImageResource XXX.Images.Tools.png}"/>        

But it cannot be used with

<Button Image="{local:FileImageResource XXX.Images.Tools.png}"/>    

Throws the following error when I call "FileImageSource.FromResource"

Cannot assign property "Image": type mismatch between "Xamarin.Forms.StreamImageSource" and "Xamarin.Forms.FileImageSource"


Viewing all articles
Browse latest Browse all 91519

Trending Articles



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