Before asking this question I googled a lot but couldn't find a solution that suits mine.
In Xamarin.Forms I have a byte[] array and I want to Convert that byte[] array to an Image. How can I achieve that, this is what I tried:
In Front End(XAML):
<StackLayout BackgroundColor="Olive" x:Name="imagePanel"> <Image x:Name="PdfImage" Aspect="AspectFill" IsVisible="true"/> </StackLayout> In Code Behind(C#):
byte[] imageAsBytes = Constant.jsonPDF; var stream1 = new MemoryStream(imageAsBytes); PdfImage.Source = ImageSource.FromStream(() => new MemoryStream(imageAsBytes)); imagePanel.Children.Add(PdfImage); But My problem is image is not displaying.
Can anybody tell me what I'm doing wrong. Any help would be greatly appreciated.
Constant.jsonPdfcontains the value and is coming from server. When i debug i can only see thebyte[694753].DependencyServicebut i'm only getting a blank screen ;(