c# - Listbox items not filling the entire width of screen WP7 -
i trying create listbox containing items following template
<listbox x:name="moviesactedin" style="{staticresource listboxstyle2}"> <listbox.itemtemplate> <datatemplate> <border borderthickness="0,0,0,1" borderbrush="black" margin="0,0,0,5"> <stackpanel orientation="horizontal" margin="0,0,0,5" horizontalalignment="stretch"> <image source="{binding image}" stretch="none" margin="0,0,5,5" /> <stackpanel orientation="vertical" margin="10,0,0,0" verticalalignment="top"> <textblock text="{binding title}" foreground="black" fontweight="bold"/> <textblock text="{binding director}" foreground="black"/> <textblock text="{binding releasedate}" foreground="black"/> </stackpanel> <image source="/images/icon_arrow.png" horizontalalignment="right" verticalalignment="center"/> </stackpanel> </border> </datatemplate> </listbox.itemtemplate>
and listbox style
<style x:key="listboxstyle2" targettype="listbox"> <setter property="background" value="transparent"/> <setter property="foreground" value="{staticresource phoneforegroundbrush}"/> <setter property="scrollviewer.horizontalscrollbarvisibility" value="disabled"/> <setter property="scrollviewer.verticalscrollbarvisibility" value="auto"/> <setter property="borderthickness" value="0"/> <setter property="borderbrush" value="transparent"/> <setter property="padding" value="0"/> <setter property="horizontalalignment" value="stretch" /> <setter property="horizontalcontentalignment" value="stretch"/> <setter property="template"> <setter.value> <controltemplate targettype="listbox"> <itemspresenter horizontalalignment="stretch" verticalalignment="stretch"/> </controltemplate> </setter.value> </setter> </style>
the first image @ left side, stackpanel 3 textblocks in middle , second image @ right hand side(at end).
the problem listbox item not filling entire width of screen have last image end of width of screen.
any help?
this worked
<listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="template"> <setter.value> <controltemplate> <contentpresenter horizontalalignment="stretch" verticalalignment="stretch" /> </controltemplate> </setter.value> </setter> </style> </listbox.itemcontainerstyle>
the items fills entire length of screen. fabrice clue.