Search code examples
c#windows-phone-7xamlsilverlight-toolkit

Selected index of listpicker in wp7


I have silverlight listpicker control in my page and Its Binded With List<Countries> Let Say

United States

United Kingdom

Pakistan

Denmark

I Bind This list with my listpickercountries I want that default selected value will be Pakistan

I can set selected item In this way

listpickercountries.selectedindex = 2;

is there any way I can find the index of Pakistan From code behind and set this selectedietm of this listpicker Like This Way

listpickercountries.selectedindex.Contain("Pakistan"); 

Or Something like that ???


Solution

  • You will have to search List for the country you want, check which index it is and then set the selected index on the picker itself.

    Indexes will be the same.