c# - Autocomplete in windows phone 7 -


i have listbox in wp7 page this

   <listbox name="lstselectednumber" height="50" maxheight="120" verticalalignment="top" grid.column="1" selectionchanged="lstselectednumber_selectionchanged">                         <listbox.itemcontainerstyle>                             <style targettype="listboxitem">                                 <setter property="padding" value="-15" />                                 <setter property="margin" value="0"/>                             </style>                         </listbox.itemcontainerstyle>                         <listbox.itemspanel>                             <itemspaneltemplate>                                 <toolkit:wrappanel>                                 </toolkit:wrappanel>                             </itemspaneltemplate>                         </listbox.itemspanel>                         <listbox.itemtemplate>                             <datatemplate>                                 <toolkit:autocompletebox x:name="acbox" filtermode="startswith" valuememberbinding="{binding name,mode=twoway}">                                     <toolkit:autocompletebox.itemtemplate>                                         <datatemplate>                                             <stackpanel orientation="horizontal">                                                 <image source="{binding image}" stretch="none" margin="0,0,5,5"/>                                                 <textblock text="{binding name}"/>                                             </stackpanel>                                         </datatemplate>                                     </toolkit:autocompletebox.itemtemplate>                                 </toolkit:autocompletebox>                             </datatemplate>                         </listbox.itemtemplate>                     </listbox> 

my listbox attached collection list<sampledata>

like lstselectednumber.itemsource = list<sampledata>;

and autocompletebox want bind auto completebox other collection list when user type in textbox shows suggestion user , once user select item adds item other collection list facing 1 problem: how can bind list autocompletbox in listbox can further proceedings?

update

i trying find listbox control in way returning me 0 childs

 private void searchvisualtree(dependencyobject targetelement)         {             var count = visualtreehelper.getchildrencount(targetelement);             if (count == 0)                 return;              (int = 0; < count; i++)             {                 var child = visualtreehelper.getchild(targetelement, i);                 if (child autocompletebox)                 {                     autocompletebox myitems = (autocompletebox)child;                      if (myitems.name == "acbox")                     {                        // logic                         return;                     }                 }                 else                 {                     searchvisualtree(child);                 }             }         } 

and in way i'm calling on page constructor

searchvisualtree(this.lstselectednumber); 

         list<wp7phone> data = new list<wp7phone>();              foreach (lines l in result)             {                 wp7phone w7 = new wp7phone();                  w7.name = l.line.trimstart();                  w7.image = "images/thump.jpg";                  msg.add(w7);             }               this.autocompletebox1.itemssource = data;      public class wp7phone  {     public string name   {     get;     set; } public string image1 {     get;     set; } 

}


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -