Xamarin Forms populate data async on create
<p>I have a Xamarin Form that is bound to a ViewModel. When this ViewModel is created I want it go get data from the DB asynchronously. My issue is I'm not sure how I to call the async method as the constructor cannot call an async method and the getter cannot call an async method.</p>

<p>I'm using pure XAML for the UI, is it possible for the XAML to call a method on initialisation?</p>

<p>My ViewModel:</p>

<pre class="lang-cs prettyprint-override"><code>public class DonorViewModel : BaseViewModel
{
    public DonorViewModel (IRepository&lt;Donor&gt; donorRepository)
    {
        _donorRepository = donorRepository;
    }

    private string _name;

    public string Name { 
        get {               
            return _name;
        }
        set {
            if (_name != value) {
                _name = value;
                OnPropertyChanged ("Name");
            }
        }
    }

    private IRepository&lt;Donor&gt; _donorRepository;

    private async Task GetName()
    {
        var donor = await _donorRepository.Get(d =&gt; d.Id == 1);
        Name = donor.Name;
    }
}
</code></pre>

<p>My XAML:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;d:ViewPage xmlns="http://xamarin.com/schemas/2014/forms"       
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
            x:Class="DonationExample.DonorView"
            xmlns:d="clr-namespace:DonationExample;assembly=DonationExample" 
            x:TypeArguments="local:DonorViewModel"
            xmlns:local="clr-namespace:DonationExample"&gt;
    &lt;ContentPage.BindingContext&gt;

    &lt;/ContentPage.BindingContext&gt;

    &lt;StackLayout Spacing="10"
           VerticalOptions="End"
           Orientation="Horizontal"
           HorizontalOptions="Start"&gt;
        &lt;Label x:Name="lblName" Font="20" Text="{Binding Name}" /&gt;

    &lt;/StackLayout&gt;

&lt;/d:ViewPage&gt;
</code></pre>

<p>XAML codebehind:</p>

<pre class="lang-cs prettyprint-override"><code>public partial class DonorView : ViewPage&lt;DonorViewModel&gt;
{
    public DonorView ()
    {
        InitializeComponent ();
    }
}
</code></pre>

<p>I thought maybe I could call it in the XAML code behind, but again this is in the constructor.</p>

<p>Any suggestions?</p>

<p>Thanks</p>