c# - how to display complete data in a listbox in windows phone 7 application -


i building application windows phone 7 have listbox in displaying data webservice. want show complete data in listbox. using textwrapping wrap still not showing data. data exceeds screen not displayed. want if clicks item in listbox navigated new page. able using button in listbox donot want use button. please have @ xaml , try solve both issue.

xaml:

<listbox name="citylist" borderthickness="0"           height="650" verticalalignment="bottom"           selectionchanged="citylist_selectionchanged" foreground="black"           background="antiquewhite" grid.row="1">  <listbox.itemtemplate>  <datatemplate>   <!--<button ishittestvisible="false" borderthickness="0">       <button.content>-->   <scrollviewer horizontalscrollbarvisibility="disabled"                verticalscrollbarvisibility="disabled"                height="80" width="800">   <stackpanel orientation="horizontal"               margin="0,0,10,10"              background="antiquewhite"               width="2000">   <image source="{binding imagebind }"          horizontalalignment="stretch"          verticalalignment="stretch"          margin="0,0,20,10" height="100"          width="145" />   <stackpanel orientation="vertical">     <stackpanel orientation="horizontal">   <textblock text="{binding city_name}"             foreground="red"              fontfamily="verdana" />   <textblock text=", " foreground="red" fontfamily="verdana" />  <textblock text="{binding state}" foreground="red"              fontfamily="verdana" />   </stackpanel>   <textblock text="{binding path=city_description}"   textwrapping="wrap" foreground="black" fontfamily="verdana" margin="10,0,10,10">  </textblock>   </stackpanel>     </stackpanel>  </scrollviewer>   <!--</button.content>      </button>-->  </datatemplate>   </listbox.itemtemplate>  </listbox> 

the comment part button when used able navigate possible navigate without using button

your structure looks bit more complicated needs think: code below work?

<listbox name="citylist" borderthickness="0"               height="600" verticalalignment="bottom"                 foreground="black"                background="antiquewhite" grid.row="1">              <listbox.itemtemplate>                 <datatemplate>                     <!--      <button ishittestvisible="false" borderthickness="0">         <button.content>-->                      <grid tap="showstate">                          <grid.columndefinitions>                             <columndefinition width="200" />                             <columndefinition width="10" />                             <columndefinition width="*" />                         </grid.columndefinitions>                          <image grid.column="0" source="http://static.bbci.co.uk/frameworks/barlesque/2.60.3/orb/4/img/bbc-blocks-dark.png"                             horizontalalignment="stretch"                             verticalalignment="stretch"                             margin="0,0,20,10" height="100" width="145" />                         <stackpanel grid.column="2">                             <textblock text="{binding city_name}"                                        foreground="red"                                         fontfamily="verdana" textwrapping="wrap" />                              <textblock text=", " foreground="red" fontfamily="verdana" />                             <textblock text="{binding state}" foreground="red" textwrapping="wrap"                           fontfamily="verdana" />                              <textblock text="{binding city_description}"                                     textwrapping="wrap" foreground="black" fontfamily="verdana" margin="10,0,10,10" />                         </stackpanel>                     </grid>                   </datatemplate>             </listbox.itemtemplate>          </listbox> 

assuming have

public class citylistdata {     public string city_name { get; set; }     public string state { get; set; }     public string city_description { get; set; } } 

your code behind

private void showstate(object sender, gestureeventargs e)     {         var control = sender grid;          if (control != null)         {             var entity = (citylistdata) control.datacontext;             messagebox.show("you clicked on state " + entity.city_name);         }     } 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -