Display photo in ToolbarItem Xamarin Forms

0

I need to display the photo on the right side of the menu with ToolbarItem .

I return the photo of the database for the "Photo" property of type string .

Convert the photo string to Base64 and assignment to component Image of Xamarin Forms .

In other%% of%, this process works perfectly, but now I need to display it in the ToolbarItem.

How can I do this?

My code:

\\ View

<ContentPage.ToolbarItems>
    <ToolbarItem Name="Menu2" Order="Primary" Priority="1">
      <ToolbarItem.Icon>
      </ToolbarItem.Icon>
    </ToolbarItem>
  </ContentPage.ToolbarItems>

\\ XAML

byte[] imageBytes;
var FileImage = new Image();
imageBytes = Convert.FromBase64String(Foto);
FileImage.Source = ImageSource.FromStream(() => new MemoryStream(imageBytes));

I need to display the photo here:

    
asked by anonymous 07.12.2016 / 13:15

1 answer

0

The property Icon gets a ImageSource .

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