Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to show the saved picker value on page reopen ?

$
0
0

Hello All,

I am using picker property for showing all the "States" and on selection I am saving those values on application current properties like below:

List stateArray = new List { "AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL",....... };
Picker picker;

picker = new MyPicker
{
TextColor = Color.FromHex("#ffffff")
};
foreach (string stateName in stateArray)
{
picker.Items.Add(stateName);
}
picker.SelectedIndex = 0;

I am storing the selected value of picker in a bean where it is stored in application current properties.
inputBean.state_province = picker.Items[picker.SelectedIndex];

Now, when the user reopens the page, I want the selected value to appear in the picker rather than showing all the first value as mentioned in SelectedIndex property each time. My values are also strings to I cannot assign picker.Items[picker.SelectedIndex] to the picker.SelectedIndex property.
Any idea, how can i implement this?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>