title: Xamarin.Forms - ListView isn't being updated in the OnAppearing method
body: <p>I'm developing an app with Xamarin.Forms, I've a screen where the user can publish a feed update, this feed update contains text and some attached files. My xaml view is basically, a <code>StackLayout</code> that contains a <code>ListView</code>, and <code>Editor</code> and a couple of <code>Buttons</code>. The problem is that I'm trying to set the <code>ItemSource</code> of my <code>ListView</code> in the <code>onAppearing</code> method. The method is being called just fine. The collection that I'm setting changes as is expected. But for some reason the <code>ListView</code> isn't being updated. A workaround that made the <code>ListView</code> work was right after setting the <code>Source</code> call the <code>Editor</code> focus method. I did because I figured out that when I clicked in the editor after the collection was suppously set, the <code>ListView</code> rendered properly. But well is a very nasty workaround.</p>
  
  <p>Here's my xaml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               x:Class="HalliganTL.View.UpdateFeedPage"&gt;
    &lt;StackLayout Orientation="Vertical" &gt;
      &lt;ListView x:Name="AttachedFilesListView" MinimumHeightRequest="50" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" &gt;
        &lt;ListView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
            &lt;ViewCell&gt;
              &lt;StackLayout HorizontalOptions="StartAndExpand" Orientation="Horizontal"&gt;
                &lt;Button Text="[X]" /&gt;
                &lt;StackLayout Padding="5,0,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical"&gt;
                  &lt;Label Text="{Binding Name}" VerticalTextAlignment="Center" FontSize="Medium" /&gt;
                &lt;/StackLayout&gt;
              &lt;/StackLayout&gt;
            &lt;/ViewCell&gt;
          &lt;/DataTemplate&gt;
        &lt;/ListView.ItemTemplate&gt;
      &lt;/ListView&gt;
      &lt;Editor x:Name="UpdateFeedEditor" FontSize="15" Text="{Binding PostText}"  VerticalOptions="FillAndExpand" /&gt;
      &lt;Button Text="Attach file" TextColor="White" BackgroundColor="#77D065" Clicked="onAttachFileClicked"/&gt;
      &lt;Button Text="Post" TextColor="White" BackgroundColor="#77D065" Clicked="onPostClicked"/&gt;
    &lt;/StackLayout&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>Here's my page code:</p>
  
  <pre><code>public partial class UpdateFeedPage : ContentPage
      {
          public static List&lt;FileObject&gt; CurrentSelectedFile = new List&lt;FileObject&gt;();
          public static string PostText = "";
  
          public UpdateFeedPage()
          {
              InitializeComponent();
              Title = "New Update";
              UpdateFeedEditor.Text = PostText;
          }
  
          protected override void OnAppearing()
          {
              AttachedFilesListView.ItemsSource = CurrentSelectedFile;
              UpdateFeedEditor.Focus();
              base.OnAppearing();
          }
  
          async void onPostClicked(object sender, EventArgs e)
          {
              await Navigation.PopAsync();
          }
  
          async void onAttachFileClicked(object sender, EventArgs e)
          {
              await Navigation.PushAsync(new FilePickerPage());
          }
      }
  </code></pre>
  
  <p>I played with a lot of things like:</p>
  
  <ul>
  <li><p>Changing the HorizontalOptions and the VerticalOptions from the ListView and the StackLayout that contains the ListView.</p></li>
  <li><p>Removed all other controls except the StackLayout and the child ListView.</p></li>
  </ul>
  
  <p>But nothing worked so far, except calling the Editor, Focus method programatically</p>
  
  <p><strong>NOTE:</strong></p>
  
  <p>As you can see the ListView collection that I'm setting is static, I modify that collection directly from another page, but I think that is OK, because when I set a breakpoint in the OnAppearing the collection was being modify properly.</p>