title: How do I solve Xamarin.Forms.Xaml.XamlParseException
body: <p>I am new to <code>Xamarin Forms</code> and <code>C#</code> too. Kindly help me to get rid of the above issue.</p>
  
  <p>I am getting </p>
  
  <blockquote>
    <p>Xamarin.Forms.Xaml.XamlParseException</p>
  </blockquote>
  
  <p>while I am trying to add the string format of my selected image source to <code>CandidateDetails.cs</code>.</p>
  
  <p>The pages are as follow:</p>
  
  <p><strong>CandidateDetails.cs</strong></p>
  
  <pre class="lang-cs prettyprint-override"><code>public event PropertyChangedEventHandler PropertyChanged;
  private string imageBase64;
  public string ImageBase64
  {
      get { return imageBase64; }
      set
      {
          imageBase64 = value;
          OnPropertyChanged("ImageBase64");
          CandImage = Xamarin.Forms.ImageSource.FromStream(
              () =&gt; new MemoryStream(Convert.FromBase64String(imageBase64)));
      }
  }
  private Xamarin.Forms.ImageSource _candImage;
  public Xamarin.Forms.ImageSource CandImage
  {
      get { return _candImage; }
      set
      {
          _candImage = value;
          OnPropertyChanged("CandImage");
      }
  }
  
  public string _candName; 
  public string CandName
  {
      get { return _candName; }
      set
      {
          if (_candName == value)
              return;
  
          _candName = value;
  
          OnPropertyChanged("CandName");
  
      }
  }
  
  public string _candInst;
  public string CandInst
  {
      get { return _candInst; }
      set
      {
          if (_candInst == value)
              return;
  
          _candInst = value;
  
          OnPropertyChanged("CandInst");
  
      }
  }
  
  public string _candEmailId;
  public string CandEmailId
  {
      get { return _candEmailId; }
      set
      {
          if (_candEmailId == value)
              return;
  
          _candEmailId = value;
  
          OnPropertyChanged("CandEmailId");
  
      }
  }
  
  public string _candMob;
  public string CandMob
  {
      get { return _candMob; }
      set
      {
          if (_candMob == value)
              return;
  
          _candMob = value;
  
          OnPropertyChanged("CandMob");
  
      }
  }
  
  private void OnPropertyChanged([CallerMemberName] string propertyName = null)
  {
      PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
  }
  </code></pre>
  
  <p><strong>CandidateDetailsModalPage.xaml.cs</strong></p>
  
  <pre class="lang-cs prettyprint-override"><code>public partial class CandidateDetailsModalPage : ContentPage
  {
      Stream input;
      string imageAsString;
  
  public static ObservableCollection&lt;CandidateDetails&gt; _candidate = new ObservableCollection&lt;CandidateDetails&gt;();
  async void OnDoneClicked(object sender, System.EventArgs e)
  {
      _candidate.Add(new CandidateDetails
          {
  
              CandName = (string)candNameEntry.Text,
              CandEmailId = (string)candEmailId.Text,
              CandMob = (string)candMobNumber.Text,
              ImageBase64 = imageAsString
  
          });
  
  
          await Navigation.PopModalAsync();
  
  }
  
  
  public CandidateDetailsModalPage()
  {
      InitializeComponent();
  
      pickPhoto.Clicked += async (sender, args) =&gt;
  {
                  if (!CrossMedia.Current.IsPickPhotoSupported)
      {
          await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");
          return;
      }
      var file = await CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
      {
          PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
      });
                  if (file == null)
          return;
                  input = file.GetStream();
                  byte[] buffer = new byte[16 * 1024];
      using (MemoryStream ms = new MemoryStream())
      {
          int read;
          while ((read = input.Read(buffer, 0, buffer.Length)) &gt; 0)
          {
              ms.Write(buffer, 0, read);
          }
                  imageAsString = Convert.ToBase64String(ms.ToArray());
      }
                  //image.Source = ImageSource.FromStream(() =&gt; new MemoryStream(Convert.FromBase64String(imageAsString)));
              image.Source = ImageSource.FromStream(() =&gt;
  {
  var stream = file.GetStream();
  file.Dispose();
  return stream;
  });
              };
          }
      }
  </code></pre>
  
  <p><strong>CandidateDetailsModalPage.xaml</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;StackLayout Orientation="Vertical" BackgroundColor="#3B4371" Padding="0"&gt;
          &lt;Button Text="Done" Clicked="OnDoneClicked" /&gt;
              &lt;ic:CircleImage x:Name="image"/&gt;
              &lt;Button x:Name="pickPhoto" Text="Pick Photo"/&gt;
              &lt;StackLayout VerticalOptions="FillAndExpand"&gt;
              &lt;Entry x:Name="candNameEntry" Placeholder="Candidate Name" /&gt;
          &lt;Entry x:Name="candInst" Placeholder="Candidate Institution / Party"/&gt;
          &lt;Entry x:Name="candEmailId" Placeholder="Candidate Email Id"  /&gt;
          &lt;Entry x:Name="candMobNumber" Placeholder="Candidate Mobile Number"/&gt;
          &lt;/StackLayout&gt;
          &lt;/StackLayout&gt;
  </code></pre>
  
  <p>The following is the backend of the xaml page where I am displaying the data CandidateDisplayPage.xaml.cs</p>
  
  <pre class="lang-cs prettyprint-override"><code>candidateListView.ItemsSource = CandidateDetailsModalPage._candidate; 
  </code></pre>
  
  <p><strong>CandidateDisplayPage</strong></p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;ListView x:Name="candidateListView"&gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;ViewCell&gt;
                  &lt;StackLayout Orientation="Horizontal"&gt;
                      &lt;Image x:Name="candImage" ImageSource="{Binding Path=CandImage}"/&gt;
                      &lt;Label Text="{Binding CandName}" x:Name="candName"/&gt;
                  &lt;/StackLayout&gt;
              &lt;/ViewCell&gt;
          &lt;/DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>