c# - Show selected value in listpicker wp8 -


i want show selected value in listpicker.

location": [                 {                     "id": "208",                     "name": "canberra"                 },                 {                     "id": "209",                     "name": "regional act"                 },                 {                     "id": "67",                     "name": "nsw"                 },                 {                     "id": "134",                     "name": "cbd, inner west & eastern suburbs"                 }             ], 

i'm convert data list.now want show selected location listpicker

 foreach (var seletedloc in _lst) { lstlocations.selecteditem = seletedloc ; } 

but error .selecteditem must set valid value

sample xaml

   <grid loaded="contentpanel_onloaded" x:name="contentpanel" grid.row="1"                margin="12,0,12,0">         <toolkit:listpicker name="mylistpicker"></toolkit:listpicker>     </grid> 

sample code:

    private void contentpanel_onloaded(object sender, routedeventargs e)     {         var datasource = new[] {"one", "two", "three"};         mylistpicker.itemssource = datasource;         mylistpicker.selecteditem = datasource[1];     } 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -