How to convert string to FileImageSource (Icon) Xamarin Forms

1

How to convert a string (Image) to FileImageSource (Icon)?

I need to display a photo in ToolbarItems in the right corner of the hamburger menu.

I tried it that way, but it did not work. My code:

FileImageSource IconFoto = new FileImageSource();

IconFoto = Foto; // Imagem retornada do BD como string

this.ToolbarItems.Add(new ToolbarItem("nome", IconFoto, () =>
{
}, ToolbarItemOrder.Primary));
    
asked by anonymous 06.12.2016 / 14:52

1 answer

1

I suppose your string is a base 64, so:

this.ToolbarItems.Add (new ToolbarItem () { Icon = ImageSource.FromStream(() => new MemoryStream(imageBytes))});
    
11.01.2017 / 01:16