Reputation: 2085
I want to assign an image to button? I have an array of bytes which represents an image. But I don't know how to convert it to the FileImageSource
.
Upvotes: 2
Views: 517
Reputation: 1396
What you are trying to do does not seem to be possible. There is no way to achieve this using FileImageSource
directly, no matter casting or other options.
For Button.Image
you can only use images stored as resources in your platform projects: Resources folder in iOS, Resources/Drawable folder in Android, and application root in WinPhone
. These images can be loaded in the button as follows:
someButton.Image = ImageSource.FromFile("imageName.png");
or
someButton.Image = "imageName.png";
Check out the Custom Renderers
(see docs). Make sure to also check this thread.
Upvotes: 1