diff --git a/BookAStar/BookAStar/Extensions/ImageResourceExtension.cs b/BookAStar/BookAStar/Extensions/ImageResourceExtension.cs new file mode 100644 index 00000000..507e61da --- /dev/null +++ b/BookAStar/BookAStar/Extensions/ImageResourceExtension.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms; +using Xamarin.Forms.Xaml; + +namespace BookAStar.Extensions +{ + [ContentProperty("Source")] + public class ImageResourceExtension : IMarkupExtension + { + public string Source { get; set; } + + public object ProvideValue(IServiceProvider serviceProvider) + { + if (Source == null) + return null; + var imageSource = ImageSource.FromResource(Source); + return imageSource; + } + } +}