hello i am working on xamarin forms 3.0 project and i am using picker to select values and using same for displaying user data to picker. Now my problem is that i am not able to show user selected value from database to picker.please help...
code behind
Below is the page constructor where i am passing my data to this page
public SummaryDetail(CpDetails cp)
{
InitializeComponent();
if (cp == null)
{
throw new System.ArgumentNullException(nameof(cp));
}
GetLocations();
BindingContext = cp;
pklocation.SelectedIndex = cp.LocationId;
}
public async void GetLocations()
{
var loci = new List<Locations>();
var client = new HttpClient();
var json = await client.GetStringAsync("this is the link from where i am getting other values in picker");
loci = JsonConvert.DeserializeObject<List<Locations>>(json);
pklocation.ItemsSource = loci;
}
Xaml is
<Picker x:Name="pklocation" Title="Select Location" ItemDisplayBinding="{Binding Name}"/>