c# - ListPicker "SelectedItem must always be set to a valid value" -


i try clear (and add) items listpicker, when app have clear of items error - "selecteditem must set valid value". code:

<toolkit:listpicker x:name="select" horizontalalignment="right" margin="0,135,30,0" verticalalignment="top" width="195" height="64" d:layoutoverrides="horizontalalignment" borderbrush="{x:null}" fontfamily="arial" fontweight="bold" fontsize="32" style="{staticresource listpickerstyle1}" borderthickness="0" datacontext="{binding}">     <toolkit:listpicker.background>         <imagebrush stretch="fill" imagesource="list_picker.png"/>     </toolkit:listpicker.background> 

and action button

private void button_tap(object sender, system.windows.input.gestureeventargs e) {     select.items.clear(); //here error     (int = 0; < arrays.length; i++)     {         select.items.add(arrays[i]);     } } 

i try options, doesn't work too.

private void button_tap(object sender, system.windows.input.gestureeventargs e) select.selecteditem = null; // here error     select.items.clear();     (int = 0; < arrays.length; i++)     {         select.items.add(arrays[i]);     } } 

to clear selection should use:

select.selecteditems.clear(); 

Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -