I am trying add a background image using the image property in button. The issue I\'m facing is that i can\'t set StreamImageSource as button background. I encountered the e
ImageSource.FromStream ()
returns a StreamImageSource
(see docs). Button.Image
accepts only FileImageSource
(see docs).
It means that what you're trying to achieve won't work, no matter how hard you try to cast one into the other.
Button.Image
will accept images stored as resources in your platform projects, and loaded either with:
Icon.Image = ImageSource.FromFile ("foobar.png");
or
Icon.Image = "foobar.png";