Building the view

Because we want to show the input photo in the input view, we need to convert it from byte[] to Xamarin.Forms.ImageSource. We will do this in a value converter that we can use together with the binding in the XAML by going through the following steps:

  1. Create a new folder called Converters in the HotDogOrNot project.
  2. Create a new class called BytesToImageConverter.
  3. Add and implement the IValueConverter interface, as shown in the following code:
using System;using System.Globalization;using System.IO;using Xamarin.Forms;  public class BytesToImageConverter : IValueConverter{     public object Convert(object value, Type targetType, object     parameter, CultureInfo culture)    {        throw new NotImplementedException();    }    public object ...

Get Xamarin.Forms Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.