Xamarin Forms ListView Binding
<p>Right now I am trying to get a ListView to have some bindable CustomCells. I defined the cells in XAML as a ViewCell under DataTemplate under ListView.ItemTemplate.</p>

<p>Let's just say for simplicity that I have two strings I represent in the Cell. The ViewCell will look something like:</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="simpletest.MyPage2"&gt;
    &lt;ContentPage.Content&gt;
        &lt;StackLayout Spacing="10" x:Name="layout" Padding="8,10"&gt;
            &lt;Label Text="{Binding Something}" /&gt;
            &lt;ListView x:Name="listView"&gt;
                &lt;ListView.ItemTemplate&gt;
                    &lt;DataTemplate&gt;
                        &lt;ViewCell&gt;
                            &lt;StackLayout Orientation="Horizontal"&gt;
                                &lt;Label Text="{Binding Name}" /&gt;
                                &lt;Label Text="{Binding Price}" /&gt;
                            &lt;/StackLayout&gt;
                        &lt;/ViewCell&gt;
                    &lt;/DataTemplate&gt;
                &lt;/ListView.ItemTemplate&gt;
            &lt;/ListView&gt;
        &lt;/StackLayout&gt;
    &lt;/ContentPage.Content&gt;
&lt;/ContentPage&gt;
</code></pre>

<p>I would really really like to keep this in XAML. I do not like to turn this into a world of bloat by writing the whole thing in C#.</p>

<p>I have a ViewModel for this page and I set the binding context in the code behind file. My question is as follows, do I define a class that extends ViewCell in C# in order to bind the data? As mentioned, I do not want to define layout in C#. I would like to bind in a way like that. I would like to avoid referencing the fields as code behind files tend to reference components. Is this possible? I checked on the Xamarin site and the example uses a mix of code behind and XAML(if I interpret it correctly...). </p>

<p>EDIT 1:</p>

<p>I tried writing a file that mimics some examples, but this is not enough. There is no piece of code explaining that this file is the one that represents the ViewCell in the XAML, and there is no obvious way for me to populate the list without accessing the list-field in codebehind. What am I missing if I just want to add some items to this list using bindings?</p>

<pre><code>public class ReportedAssignmentCell : ViewCell
{
    public ReportedAssignmentCell()
    {
    }

    public static readonly BindableProperty NameProperty = BindableProperty.Create("Name", typeof(string), typeof(ReportedAssignmentCell), "");
    public static readonly BindableProperty PriceProperty = BindableProperty.Create("Price", typeof(string), typeof(ReportedAssignmentCell), "");



    public string Name
    {
        get { return (string)GetValue(NameProperty); }
        set { SetValue(NameProperty, value); }
    }
    public string Price
    {
        get { return (string)GetValue(PriceProperty); }
        set { SetValue(NameProperty, value); }
    }
}
</code></pre>