xaml - WPF - GridView items inside the listview cannot be properly aligned -
i have following .xaml file. have grid view inside listview. gridview contains 2 columns. issue items of first column cannot aligned in way want be.
<listview ....> <gridview....> <gridviewcolumn header=" ...." ....> <gridviewcolumn.celltemplate> <datatemplate> <stackpanel .....> <textblock text="{binding name}" ..../> </stackpanel> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn header="....." ....> <gridviewcolumn.celltemplate> <datatemplate> <itemscontrol itemsource="{binding namelist}"> <itemscontrol.datatemplate> <stackpanel ....> <textbox text="{binding itemname}"> </stackpanel> </itemscontrol.datatemplate> </itemscontrol> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> </gridview> </listview>
what ouput following.
* item 1 * item 2 header 1 * item 3 * item 4 * item 5 * item 1 header 2 * item 2 * item 3
what need following
header 1 * item 1 * item 2 * item 3 * item 4 * item 5 header 2 * item 1 * item 2 * item 3
could pls me fix ?
found solution !
<listview ...> <listview.itemcontainerstyle> <style targettype="listviewitem"> <setter property="verticalcontentalignment" value="top" /> </style> </listview.itemcontainerstyle> ......... </listview>
Comments
Post a Comment