title: ListView Databinding with custom views
body: <p>I'm trying to get a custom list of custom views (I eventually will add controls to each view) displayed using databinding in a xamarin project. However when I run my project, nothing shows up on the list. I'm kind of new to the databinding stuff so I'm a little confused. I've searched and tried some other solutions but haven't been able to figure out my specific issue. Any help would be appreciated. Here's my code:</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="XamarinTuts.XMainPage"&gt;
  
    &lt;ContentPage.Content&gt;
      &lt;StackLayout&gt;
        &lt;Label Text="Tasks:" HorizontalTextAlignment="Start" VerticalTextAlignment="Start" x:Name="tasksLabel"&gt;&lt;/Label&gt;
        &lt;ListView ItemsSource="{Binding taskItems}"&gt;
          &lt;ListView.ItemTemplate&gt;
            &lt;DataTemplate&gt;
              &lt;Frame BackgroundColor="Black" Padding="5"&gt;
                &lt;Grid&gt;
                  &lt;StackLayout Name="TextStack" Orientation="Vertical" Grid.Column="0"&gt;
                    &lt;Label Text="{Binding Name}"&gt;&lt;/Label&gt;
                    &lt;Label Text="{Binding Description}"&gt;&lt;/Label&gt;
                  &lt;/StackLayout&gt;
                  &lt;StackLayout Name="ButtonStack" Orientation="Horizontal" HorizontalOptions="End" Grid.Column="1"&gt;
                    &lt;Button Name="Edit" Text="Edit" Width="50" Height="50"&gt;&lt;/Button&gt;
                  &lt;/StackLayout&gt;
                &lt;/Grid&gt;
              &lt;/Frame&gt;
            &lt;/DataTemplate&gt;
          &lt;/ListView.ItemTemplate&gt;
        &lt;/ListView&gt;
  
      &lt;/StackLayout&gt;
  
    &lt;/ContentPage.Content&gt;  
  
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>That's my XAML. Here's my XMainPage.cs:</p>
  
  <pre><code>public partial class XMainPage : ContentPage
  {
  
  
      TestViewModel vm;
  
      public XMainPage()
      {
  
          InitializeComponent();
  
          vm = new TestViewModel();
  
          TaskListItem testItem = new TaskListItem(this, "Go shopping", "Drive to meijer and get the following: Milk, Eggs, Booze");
          TaskListItem testItem2 = new TaskListItem(this, "Play Overwatch", "Pwn some n00bs");
          vm.taskItems.Add(testItem);
          vm.taskItems.Add(testItem2);
  
  
          BindingContext = vm;
      }
  
  }
  </code></pre>
  
  <p>Followed by my TestViewModel.cs:</p>
  
  <pre><code>public class TestViewModel : INotifyPropertyChanged
  {
  
      ObservableCollection&lt;TaskListItem&gt; mtaskItems;
  
      public TestViewModel()
      {
          mtaskItems = new ObservableCollection&lt;TaskListItem&gt;();
      }
  
  
      public ObservableCollection&lt;TaskListItem&gt; taskItems
      {
          get
          {
              return mtaskItems;
          }
          set
          {
              mtaskItems = value;
          }
      }
      public event PropertyChangedEventHandler PropertyChanged;
  
      void OnPropertyChanged(string name = null)
      {
  
          var changed = PropertyChanged;
  
          if (changed == null)
              return;
  
          changed.Invoke(this, new PropertyChangedEventArgs(name));
  
      }
  }
  </code></pre>
  
  <p>Followed by my TaskListItem.cs:</p>
  
  <pre><code>public class TaskListItem : ViewCell
  {
  
      public Task newTask;
  
      String mName;
      String mDescription;
  
      public String Name
      {
          get
          {
              return mName;
          }
      }
  
      public String Description
      {
          get
          {
              return mDescription;
          }
      }
  
  
      public TaskListItem(ContentPage taskListItemParent, String TaskName, String TaskDescription)
      {
          //newTask = new Task(TaskName, TaskDescription);
  
          mName = TaskName;
          mDescription = TaskDescription;
  
      }
  }
  </code></pre>