c# - Indent first column in GridView of ListView -



c# - Indent first column in GridView of ListView -

i have created gridview using list view. there 2 level of nodes , indent kid node. therefore, have set margin in <itempresenter>. result looks pretty sec , 3rd column been indent , not align according header column. thought indent first column not rest column?

xaml

<listview name="listviewresult" margin="10,231,0,-299" borderbrush="#ff000000" borderthickness="1" > <listview.view> <gridview> <gridviewcolumn header="name" width="280" displaymemberbinding="{binding grandchildnodedata}" /> <gridviewcolumn header="date/ time" width="160" displaymemberbinding="{binding time}" /> <gridviewcolumn header="state" width="160" displaymemberbinding="{binding state}" /> </gridview> </listview.view> <listview.groupstyle> <groupstyle> <groupstyle.containerstyle> <style targettype="{x:type groupitem}"> <setter property="template"> <setter.value> <controltemplate> <expander isexpanded="true"> <expander.header> <stackpanel orientation="horizontal"> <textblock text="{binding name}" fontweight="bold" verticalalignment="bottom" /> <textblock text="{binding itemcount}" foreground="silver" fontstyle="italic" margin="10,0,0,0" verticalalignment="bottom" /> <textblock text=" item(s)" foreground="silver" fontstyle="italic" verticalalignment="bottom" /> </stackpanel> </expander.header> <itemspresenter margin="20,0,0,0" /> </expander> </controltemplate> </setter.value> </setter> </style> </groupstyle.containerstyle> </groupstyle> </listview.groupstyle> </listview>

result

this question has been answered magnus in forum

"you setting margin of entire groupitem. should define celltemplate first column , set margins in there:"

<listview.view> <gridview> <gridviewcolumn header="name" width="120"> <gridviewcolumn.celltemplate> <datatemplate> <textblock text="{binding name}" margin="20 0 0 0"/> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> <gridviewcolumn header="date/ time" width="160" displaymemberbinding="{binding time}" /> <gridviewcolumn header="state" width="160" displaymemberbinding="{binding state}" /> </gridview> </listview.view> <listview.groupstyle> <groupstyle> <groupstyle.containerstyle> <style targettype="{x:type groupitem}"> <setter property="template"> <setter.value> <controltemplate> <expander isexpanded="true"> <expander.header> <stackpanel orientation="horizontal"> <textblock text="{binding name}" fontweight="bold" verticalalignment="bottom" /> <textblock text="{binding itemcount}" foreground="silver" fontstyle="italic" margin="10,0,0,0" verticalalignment="bottom" /> <textblock text=" item(s)" foreground="silver" fontstyle="italic" verticalalignment="bottom" /> </stackpanel> </expander.header> <itemspresenter /> </expander> </controltemplate> </setter.value> </setter> </style> </groupstyle.containerstyle> </groupstyle> </listview.groupstyle>

c# listview gridview expander

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -