title: Populate Picker with Data using MVVM Xamarin Forms
body: <p>I am trying to get a picker to populate with data. There doesn't seem to be a straight answer anywhere on this. I have tried numerous things, one thing that does work is :</p>
  
  <p>Xaml:</p>
  
  <pre><code>&lt;Picker Grid.Row="2"
             Grid.Column="0"
             Grid.ColumnSpan="4"
             Title="Driver Name"
              ItemsSource="{Binding Drivers}"                
              SelectedItem="{Binding driverID}"
  </code></pre>
  
  <p>and in the View Model:</p>
  
  <pre><code>List&lt;string&gt; Drivers = new List&lt;string&gt; { "Steve","Dave" };
  </code></pre>
  
  <p>This works fine, but its just a dummy capability as in the future these names will be grabbed from a service of some kind.
  So in an attempt to copy this I tried separating this list into a mock service and just returning the list to the view model and making it work that way.</p>
  
  <p>But this still returns nothing to the front end even though I can see that the list is not blank when debugging.
  Then I tried to create a class of Driver and return instances of the class that has the name in it and access it in the Xaml.
  This did not work, I even tried a variation using IList, this did not work either.</p>
  
  <p>I am not sure why this does not work as the list was just separated to essentially a different class. For instance this is what I am trying now:</p>
  
  <p>Xaml:</p>
  
  <pre><code> &lt;Picker Grid.Row="2"
             Grid.Column="0"
             Grid.ColumnSpan="4"
             Title="Driver Name"
              ItemsSource="{Binding Drivers}"                
              SelectedItem="{Binding driverID}"
              /&gt;
  </code></pre>
  
  <p>View Model:</p>
  
  <p>This is bound to the picker</p>
  
  <pre><code>public List&lt;string&gt; Drivers;
  </code></pre>
  
  <p>Then this method is called from the constructor:</p>
  
  <pre><code> public async Task FindDriverNames()
      {
          Drivers = await GetDriverNames();           
      }
  </code></pre>
  
  <p>and in the Model:</p>
  
  <pre><code> public async Task&lt;List&lt;string&gt;&gt; GetDriverNames()
          {
              await Sleep();
  
              List&lt;string&gt; _drivers = new List&lt;string&gt; { "Steve"};
  
              return _drivers;          
  
          }
  </code></pre>
  
  <p>This does not work, but when run through debug it shows that Drivers is populated.
  I have wasted a lot of time trying to get this work, does anyone have insights?</p>