c# - WPF '*' character not spacing correctly -
c# - WPF '*' character not spacing correctly -
i have listbox
in windows universal app , each listboxitem
grid
columns of varying text , images. columndefinitions
have specific widths , trying distribute remaining space evenly among remaining columns. understand *
character instead seems behaving more auto
, allocating necessary amount of space.
so instead of foo bar baz
getting foobarbaz
.
does might know doing wrong?
<listbox x:name="itemslistbox" grid.row="3" margin="0, 80, 0, 80" verticalalignment="top" itemssource="{binding items}" loaded="itemslistbox_loaded"> <listbox.itemspanel> <itemspaneltemplate> <stackpanel orientation="vertical" /> </itemspaneltemplate> </listbox.itemspanel> <listbox.itemtemplate> <datatemplate> <grid x:name="itemslistboxgrid"> <grid.columndefinitions> <columndefinition width="60" /> <columndefinition width="150" /> <columndefinition width="45" /> <columndefinition width="100" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="*" /> <columndefinition width="*" /> </grid.columndefinitions> <image grid.column="0" height="40" source="{binding img}" /> <textblock grid.column="1" text="{binding name}" /> <textblock grid.column="2" text="{binding level}" /> <textblock grid.column="3" text="{binding rarity}" /> <textblock grid.column="4" text="{binding type}" /> <textblock grid.column="5" text="{binding minsaleoffer}" /> <textblock grid.column="6" text="{binding maxbuyoffer}" /> <textblock grid.column="7" text="{binding margin}" /> <textblock grid.column="8" text="{binding supply}" /> <textblock grid.column="9" text="{binding demand}" /> </grid> </datatemplate> </listbox.itemtemplate> </listbox>
you don't wrong, it's default container (listboxitem) style aligns content left preventing grid measure/arrange. add together next listbox.
<listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="horizontalalignment" value="stretch"/> <setter property="horizontalcontentalignment" value="stretch"/> </style> </listbox.itemcontainerstyle>
c# wpf
Comments
Post a Comment