title: Xamarin - ListView Displaying Data on IOS
body: <p>My list views data displays correctly on UWP and Android but not for IOS. I think it has something to do with the <code>OnAppearing</code> method I'm using and when it actually gets called on IOS.</p>
  
  <p>From my Dashboard when I navigate to an Item list page I have the following code behind on the <code>ItemPage</code></p>
  
  <pre><code>public ItemPage(string category = null, bool fromDashboard = false)
  {
      InitializeComponent();
      BindingContext = new ItemViewModel(category, fromDashboard);
  }
  
  protected override void OnAppearing()
  {
      var vm = BindingContext as ItemViewModel;
      vm?.GetData();
      base.OnAppearing();
  }
  </code></pre>
  
  <p>Then in my <code>ItemViewModel</code> class I have a constructor that accepts a <code>category</code> and <code>fromDashboard</code> flag and sets some properties.</p>
  
  <p>The <code>ItemViewModel</code> <code>GetData()</code> call is as follows:</p>
  
  <pre><code>public void GetData()
  {
      this.Items = this.RefreshData(this.ItemService.GetAll(this.SelectedCategory));
  
      if (this.FromDashboard)
          this.Items = this.Items.Where(x =&gt; x.Status != "Complete").ToObservableCollection();
  }
  </code></pre>
  
  <p>And then finally the <code>ItemPage.xaml</code> has a <code>ListView</code> with the <code>ItemsSource="{Binding Items}"</code> </p>
  
  <p>For some reason this works fine on Windows and Android but no data will show on IOS. Is the page being rendered before the OnAppearing method or something?</p>