c# - Windows Phone ListBox item height -


i've searched lot answer , couldn't find one.
so: i'm making windows phone app (targeting 7.1) , have listbox following itemtemplate

<listbox.itemtemplate>     <datatemplate>         <grid>             <textblock x:name="subjectname" text="{binding path=name}" textwrapping="wrap" foreground="white" fontsize="30" fontfamily="segoe wp semibold" width="440" height="99"/>             <textblock x:name="subjectcode" text="{binding path=code}" fontsize="25" width="107" horizontalalignment="right" margin="0,79,0,-12"/>             <textblock x:name="totalabsences" text="{binding path=absences}" fontsize="30" width="107" horizontalalignment="left" margin="0,119,0,-65"/>             <textblock x:name="totalgrade" text="{binding path=grades}" fontsize="30" width="186" horizontalalignment="right" margin="0,119,0,-62" textalignment="right"/>             <rectangle fill="white" height="3" margin="0,0,0,-233" />         </grid>     </datatemplate> </listbox.itemtemplate> 

and happens:

http://d.pr/i/libk (can't post images here yet)

so can done item's height adjusted automatically?

since each item in listbox enclosed in grid, can specify grid.rowdefinitions , assign each of children in grid have row number.

sample:

<grid>     <grid.rowdefinitions>         <rowdefinition height="auto"></rowdefinition> <!-- gets whatever height necessary -->         <rowdefinition height="140"></rowdefinition> <!-- specific height -->         <rowdefinition maxheight="*"></rowdefinition> <!-- fills whatever space left -->     </grid.rowdefinitions>     <textblock x:name="subjectname" text="{binding path=name}" grid.row="0"/>     <textblock x:name="subjectcode" text="{binding path=code}" grid.row="1"/>     <textblock x:name="totalabsences" text="{binding path=absences}" grid.row="2"/> </grid> 

i used of code , removed properties sake of simplicity. play around , see works.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -