c# - app crash while loading large amount of items to listbox -


i developing windows phone8 app have listbox shows large number of items, have image control inside data template of listbox.

when load first 100 items working well, when load next 100 items(totally 200) app crash happens.

can me solve issue.

here code list box

<listbox scrollviewer.verticalscrollbarvisibility="disabled" visibility="visible" x:name="commentslistbox" verticalalignment="top" >                     <listbox.itemtemplate>                         <datatemplate>                             <border borderbrush="#ffb9b9b9" borderthickness="0,0,0,2" width="462" margin="14,0,0,0">                                 <grid verticalalignment="top" width="470" >                                     <image horizontalalignment="left" height="100" width="100" verticalalignment="top" margin="10,20,0,0" stretch="fill" source="{binding profileimage}"></image>                                     <textblock name="usernametextblock"  verticalalignment="top" fontweight="bold" horizontalalignment="left" text="{binding username}" foreground="black" height="36" width="238" margin="136,18,0,0" texttrimming="wordellipsis" fontfamily="tahoma" />                                     <stackpanel verticalalignment="top" horizontalalignment="left" margin="146,68,0,0" width="314">                                         <textblock name="commenttextblock" verticalalignment="top" textalignment="left" horizontalalignment="left" foreground="black" text="{binding comment}" width="313" textwrapping="wrap" fontfamily="tahoma" margin="0,0,-17,0" ></textblock>                                         <textblock text="{binding date}" height="36" foreground="red" width="264"  name="commentdate" horizontalalignment="right" verticalalignment="bottom" margin="0,0,10,0" texttrimming="wordellipsis" fontfamily="tahoma"></textblock>                                         <button horizontalalignment="right" width="100" content="view" height="70" fontsize="18" x:name="viewbtn" background="#ffd71d26" verticalalignment="bottom" margin="0,0,-10,-10"></button>                                     </stackpanel>                                  </grid>                             </border>                         </datatemplate>                     </listbox.itemtemplate>                     <!--<listboxitem>              </listboxitem>-->                 </listbox> 

and class have data is

 public class wishlistcommentcommonformate {     public string comment { get; set; }     public string username { get; set; }     public datetime date { get; set; }     public string profileimage { get; set; } } 

here image given url website. saw improving listbox performance in silverlight windows phone 7: data virtualization , few more examples that, couldn't got idea fix issue.

please give me idea. thank you.

two suggestions. first if must use listbox you'll have better performance , virtualization of images reading listbox why art thou blanking. in article windows phone development team mention different way set images.

<image>      <image.source>          <bitmapimage urisource="{binding imgurl}" createoptions="backgroundcreation"/>      </image.source>  </image> 

the second suggestion (and better) not use lstbox instead use longlistselector. control made performant, , use less memory. find/replace listbox longlistselector in xaml.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -