Créer android spinner de façon dynamique dans Xamarin

Je suis un débutant de Xamarin et je veux créer une application simple pour se familiariser avec Xamarin. Je veux créer et remplir la casserole et afficher les options de manière dynamique. J'ai vu la documentation ici mais il n'est pas créé par programmation. Toute aide sera apreaciated

var levels = new List<String>() { "Easy", "Medium", "Hard", "Multiplayer" };
var adapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleSpinnerItem, levels);
                    adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
var spinner = FindViewById<Spinner>(Resource.Id.spnrGameLevel);
spinner.Adapter = adapter;

spinner.ItemSelected += (sender, e) =>
{
    var s = sender as Spinner;
    Toast.MakeText(this, "My favorite is " + s.GetItemAtPosition(e.Position), ToastLength.Short).Show();
};

Mon axml fichier

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Choose your game level" />
    <Spinner
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/spnrGameLevel" />
</LinearLayout>

OriginalL'auteur Anand | 2013-10-03