Search code examples
imagemvvmxamarinimagesourcexamarin.forms

Xamarin Forms: How to use Embedded Resources in PCL Project for Image


I have 4 Images in my Resources Directory into my Portable Project and i would like to use them directly for an ImageSource (because i need to bind it).

ImageSource myImageSource = ImageSource.FromResource("resources.image.png");

I tried this but it doesn't recognize the path. How can i use my images for an ImageSource ?


Solution

  • Ok, my bad i forgot the name of my project before the Resources directory

    ImageSource myImageSource = ImageSource.FromResource("NameOfProject.Resources.image.png");