Cubicle Ninja

April 24, 2018

Xamarin.Forms ImageSource from Resource Files

Filed under: C#,Xamarin — Cubicle Ninja @ 8:21 pm

This is a useful helper class for Xamarin.Forms that will allow you to easily reference a file asset that is tagged as an Embedded Resource easily from your XAML mark-up.  This is taken from the Xamarin.Forms documentation and modified slightly because I was having issues with it properly loading the resource files after upgrading to the latest version.

Once that is in place, you use it the same as the Xamarin.Forms documentation:

  1. Add a custom xmlns to your XAML page referencing your namespace and assembly:
  2. Use your custom xmlns as the source for your Image

    (keep in mind that if you created a folder for your embedded resources, that will be part of the resource namespace)

Powered by WordPress