c# - How to get selected item from AutoSuggestBox in Windows Phone 8.1 -
in cs file "selecteditem" not working alternative "selecteditem" autosuggestbox in wp8.1
in xaml file:
<autosuggestbox x:name="tblkpersonname" width="380" margin="0,-7,0,0" itemssource="{binding}" textchanged="tblkpersonname_textchanged"> <autosuggestbox.itemtemplate> <datatemplate> <textblock text="{binding name}" tag="{binding personid}"/> </datatemplate> </autosuggestbox.itemtemplate> </autosuggestbox>
in cs file:
private void tblkpersonname_textchanged(autosuggestbox sender, autosuggestboxtextchangedeventargs args) { try { if (tblkpersonname.selecteditem != null) { tblkdes.text = ((values)tblkpersonname.selecteditem).description; persononlineimg.source = new bitmapimage(new uri(((values)tblkpersonname.selecteditem).flickrpersonimageurl, urikind.relativeorabsolute)); } } catch (exception ex) { exceptions.saveorsendexceptions("exception in tblkpersonname_selectionchanged_1 method in addcast.cs file.", ex); } }
there's no "selecteditem" in autosuggestbox provided windows phone 8.1 , neither there's 1 in developer tools windows 10. autosuggestbox works regular textbox, plus here's possibility have panel/popup show ups giving suggestions based on itemssource passed. works if itemssource collection of string, since displaymemberpath doesn't work, @ least me. way retrieve "selecteditem" should use text property. know it's not same, autosuggestbox it's not combobox.
Comments
Post a Comment