I would recommend binding both the ItemsSource AND the SelectedItem as such
<toolkit:ListPicker x:Name="listpickercountries"
ItemsSource="{Binding Countries}"
SelectedItem="{Binding SelectedCountry, Mode=TwoWay}">
In your code behind, set a viewmodel
public SettingsPage()
{
ViewModel = new ViewModel();
InitializeComponent();
}
private ViewModel ViewModel
{
get { return DataContext as ViewModel; }
set { DataContext = value; }
}
And in the viewmodel
public class ViewModel : INotifyPropertyChanged
{
public IList<Country> Countries
{
get { return _countries; }
private set
{
_countries = value;
OnPropertyChanged("Countries");
}
}
public Country SelectedCountry
{
get { return _selectedCountry; }
private set
{
_selectedCountry= value;
OnPropertyChanged("SelectedCountry");
}
}
}
From there you can set the value of the SelectedCountry at any time and it will set the selected item within the picker
eg:
// from code behind
ViewModel.SelectedCountry = ViewModel.Countries.FirstOrDefault(c => c.Name == "Pakistan");
// From ViewModel
this.SelectedCountry = this.Countries.FirstOrDefault(c => c.Name == "Pakistan");