wpf - StackPanel don't grow with Textblock in Windows Phone 8 Application -


i'm trying show text in page of application in 3 textblocks. want scroll because text dynamically changed , depends on choose in previous page. when did that:

<!--layoutroot root grid page content placed--> <grid x:name="layoutroot" background="transparent">     <grid.rowdefinitions>         <rowdefinition height="auto"/>         <rowdefinition height="*"/>     </grid.rowdefinitions>      <!--titlepanel contains name of application , page title-->     <stackpanel name="titlepanel" grid.row="0" margin="12,17,0,28">         <textblock text="asystent barmana" style="{staticresource phonetextnormalstyle}"/>         <textblock name="pagename" text="page name" margin="9,-7,0,0" style="{staticresource phonetexttitle1style}"/>     </stackpanel>     <scrollviewer name="scroller"  horizontalalignment="center" height="auto" margin="12,10,10,-1055" grid.row="1" verticalalignment="top" width="460" manipulationmode="control" maxheight="2500" >         <stackpanel horizontalalignment="left" height="auto" verticalalignment="top" width="460">             <textblock name="missingskladnik" textwrapping="wrap" height="auto" fontsize="24"/>             <textblock name="skladniki" textwrapping="wrap" height="auto" fontsize="24"/>             <textblock name="przepis" textwrapping="wrap" height="auto" fontsize="24"/>         </stackpanel>     </scrollviewer>  </grid> 

, text not long work fine. in several cases text longer , of text cut off. when change stackpanel height to, let's 1950, dispaly fine, when have shorter text, on end of page black nothing scroll :/ thoughts?

ps. apologize english, it's been while since used ;)

edit:

i read comments , change stackpanel grid. did that:

<scrollviewer name="scroller"  horizontalalignment="center" height="auto" margin="12,10,10,-1055" grid.row="1" verticalalignment="top" width="460" manipulationmode="control" maxheight="2500" >         <grid>             <grid.rowdefinitions>                 <rowdefinition height="auto"/>                 <rowdefinition height="auto"/>                 <rowdefinition height="*"/>             </grid.rowdefinitions>             <textblock name="missingskladnik" textwrapping="wrap" height="auto" fontsize="24" grid.row="0"/>             <textblock name="skladniki" textwrapping="wrap" height="auto" fontsize="24" grid.row="1"/>             <textblock name="przepis" textwrapping="wrap" height="auto" fontsize="24" grid.row="2"/>         </grid>     </scrollviewer> 

it doesn't work either. if set height of stackpanel works, when there small amount of text doesn't nice. user can srcoll black empty screen :/

a stackpanel not resize content in same way canvas not resize content. however, grid control can resize contents. try replacing this:

<stackpanel name="titlepanel" grid.row="0" margin="12,17,0,28">     <textblock text="asystent barmana" style="{staticresource phonetextnormalstyle}"/>     <textblock name="pagename" text="page name" margin="9,-7,0,0" style="{staticresource phonetexttitle1style}"/> </stackpanel> 

with this:

<grid name="titlegrid" grid.row="0" margin="12,17,0,28">     <grid.columndefinitions>         <columndefinition width="auto" />         <columndefinition />     </grid.columndefinitions>     <textblock grid.row="0" text="asystent barmana"          style="{staticresource phonetextnormalstyle}"/>     <textblock grid.row="1" name="pagename" text="page name" margin="9,-7,0,0"          style="{staticresource phonetexttitle1style}"/> </grid> 

update >>>

in wpf, setting explicit height and/or width dimensions and/or margins stop control sizing itself. if want scrollviewer re-size size of content, try remove explicit layout , dimension values have set, eg. margin.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -