as i'm new windows phone application, facing problem, helpful if suggest valuable answer. have 2 textblock
in grid inside listbox
. need programmatically change margin of second textblock because if app run in bigger screen second textblock bad aligned. first textblock should aligned left second textblock should aligned right when set in in textblock not working need change margin.
image here: https://dl.dropboxusercontent.com/u/40039421/untitled-1.png
<grid grid.row="2" grid.column="0"> <listbox x:name="lbtoday" fontsize="13" tapped="lbtoday_tapped" horizontalcontentalignment="left" horizontalalignment="left"> <listbox.itemtemplate> <datatemplate> <grid> <textblock x:name="tbtodaysubjectname" foreground="#ff02416c" text="aplikovana inforatika" horizontalalignment="left" margin="0,0,75,0" /> <textblock x:name="tbsubjecthourstart" foreground="#ff02416c" text="10:30" horizontalalignment="right" padding="0,0,0,0" /> </grid> </datatemplate> </listbox.itemtemplate> </listbox> </grid>
you can solve problem making inner grid 2 columns , have each textbox
in own column. way won't need change @ runtime , layout should work.
<listbox> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="horizontalcontentalignment" value="stretch"/> </style> </listbox.itemcontainerstyle> <listbox.itemtemplate> <datatemplate> <grid> <grid.columndefinitions> <columndefinition /> <columndefinition /> </grid.columndefinitions> <textblock horizontalalignment="left" /> <textblock horizontalalignment="right" grid.column="1" /> </grid> </datatemplate> </listbox.itemtemplate> </listbox>
Comments
Post a Comment