c# - My scrollview is not working in windows phone 8.1 -
my scrollview not working in windows phone 8.1. here code. please me. textblock see in bind database. fetch data database , show in scrollviewer. suggest me correct code.
<phone:pivotitem header="market status"> <grid> <grid.rowdefinitions> <rowdefinition height="auto"/> <rowdefinition height="auto"/> <rowdefinition height="*"/> </grid.rowdefinitions> <button x:name="btnrefresh" grid.row="0" horizontalalignment="center" verticalalignment="bottom" width="80" height="80" borderbrush="transparent" click="btnrefresh_click"> <button.background> <imagebrush imagesource="/assets/icons/refresh2.png"/> </button.background> </button> <stackpanel orientation="vertical" horizontalalignment="center" margin="20,10,20,10" grid.row="1"> <stackpanel.background> <imagebrush imagesource="/assets/icons/bg-market-highlight.png"/> </stackpanel.background> <stackpanel margin="10,20,10,0"> <stackpanel.background> <imagebrush imagesource="/assets/icons/market-status-bar.png"/> </stackpanel.background> <stackpanel x:name="stack_datetimenstatus" orientation="horizontal" > <textblock text="status:" fontsize="22" foreground="black" margin="10,0,10,0" /> <textblock x:name="txbmarketstatus" text="{binding marketstatus}" fontsize="22" foreground="black" width="85" /> <textblock x:name="txbdate" text="{binding datetime}" fontsize="22" width="210" textalignment="right" horizontalalignment="right" foreground="black" margin="5,0,0,0" /> </stackpanel> </stackpanel> <stackpanel x:name="stack_listbox_markethighlights" margin="0,10,0,10"> <listbox x:name="listbox_markethighlights" itemssource="{binding}" scrollviewer.verticalscrollbarvisibility="disabled"> <listbox.itemtemplate> <datatemplate x:name="datatemplate_markethighlights"> <stackpanel orientation="horizontal"> <textblock x:name="txb_title_value" width="250" foreground="black" horizontalalignment="left" text="{binding title}" margin="10,0,10,0" /> <textblock x:name="txb_value_value" width="125" foreground="black" horizontalalignment="right" textalignment="right" text="{binding value}" margin="0,0,10,0" /> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> </stackpanel> </stackpanel> <stackpanel orientation="vertical" horizontalalignment="center" margin="20,10,20,10" grid.row="2"> <stackpanel.background> <imagebrush imagesource="/assets/icons/bg-market-highlight.png"/> </stackpanel.background> <stackpanel x:name="stack_listbox_favorite" margin="0,10,0,10"> <stackpanel margin="10,10,10,0"> <stackpanel.background> <imagebrush imagesource="/assets/icons/market-status-bar.png"/> </stackpanel.background> <stackpanel orientation="horizontal" > <!--<textblock text="industry" fontsize="22" foreground="black" width="180" margin="10,0,10,0" />--> <textblock text="symbol" fontsize="22" foreground="black" width="250" margin="10,0,0,0" /> <textblock text="change" fontsize="22" width="125" textalignment="right" horizontalalignment="right" foreground="black" margin="0,0,10,0" /> </stackpanel> </stackpanel> <stackpanel margin="0,10,0,10"> <scrollviewer> <listbox x:name="listbox_favorite" itemssource="{binding}" virtualizingstackpanel.virtualizationmode="recycling" scrollviewer.verticalscrollbarvisibility="disabled"> <listbox.itemtemplate> <datatemplate > <stackpanel orientation="horizontal"> <textblock x:name="txb_symbol_name" foreground="black" width="250" horizontalalignment="left" textalignment="left" text="{binding symbol_name}" margin="10,0,10,0" grid.column="0" /> <textblock x:name="txb_change_value" foreground="black" width="125" horizontalalignment="right" textalignment="right" text="{binding change}" margin="0,0,0,0" grid.column="1"/> <!--<stackpanel orientation="horizontal">--> <!--<textblock x:name="txb_industry_name" width="180" foreground="black" horizontalalignment="left" text="{binding industry_name}" margin="10,0,10,0" />--> <!--<textblock x:name="txb_symbol_name" foreground="black" width="250" horizontalalignment="left" textalignment="left" text="{binding symbol_name}" margin="10,0,0,0" /> <textblock x:name="txb_change_value" foreground="black" width="125" horizontalalignment="right" textalignment="right" text="{binding change}" margin="0,0,10,0" /> </stackpanel>--> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox> </scrollviewer> <textblock x:name="txbnorecordes" text="no record found" visibility="collapsed" horizontalalignment="left" verticalalignment="top" fontsize="30" grid.row="0" margin="20,0,0,0" foreground="black"/> </stackpanel> </stackpanel> </stackpanel> </grid> </phone:pivotitem>
i saw comment , have code example how work me, put in right place , should help:
<scrollviewer padding="20" horizontalalignment="center"> <listbox horizontalalignment="stretch" verticalalignment="stretch"> .... </listbox> </scrollviewer>
you can play params want, horizontalalignment
, verticalalignment
important, don't forget set them.
Comments
Post a Comment