c# - How set same height in group of listbox? -
i have problem generating listbox.
have dataset many rows , need split 1 big table 2 or more depends on rowslimit. 1 table 100 rows became 2 tables 50 rows , on. these blocks display next each other.
use listbox grouping (in code behind set property filtering) , works well. each row has different height , need last row in group fills remaining space in every group. tried use dock panel, changes nothing.
also need create , set groupstyle.headertemplate in runtime, because have in dataset number of columns, width, bordercolor, , other properties. how can replace datatemplate "headergroupstyle" new?
<listbox name="lbtable" > <listbox.resources> <datatemplate x:key="headergroupstyle"> <stackpanel orientation="horizontal"> <textbox width="100" text="header 1" /> <textbox width="100" text="header 2" /> <textbox width="100" text="header 3" /> <textbox width="100" text="header 4" /> </stackpanel> </datatemplate> <style targettype="{x:type groupitem}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type groupitem}"> <dockpanel> <contentpresenter dockpanel.dock="top"/> <itemspresenter margin="0,0,0,0" dockpanel.dock="top"/> </dockpanel> </controltemplate> </setter.value> </setter> </style> </listbox.resources> <listbox.itemcontainerstyle> <style targettype="listboxitem"> <setter property="padding" value="0"/> </style> </listbox.itemcontainerstyle> <listbox.itemtemplate> <datatemplate> <stackpanel orientation="horizontal" dockpanel.dock="top"> <textbox width="100" text="{binding path=cell[0].value}" /> <textbox width="100" text="{binding path=cell[1].value}" /> <textbox width="100" text="{binding path=cell[2].value}" /> <textbox width="100" text="{binding path=cell[3].value}" /> </stackpanel> </datatemplate> </listbox.itemtemplate> <listbox.groupstyle> <groupstyle headertemplate="{staticresource headergroupstyle}"> <groupstyle.panel> <itemspaneltemplate> <stackpanel orientation="horizontal" /> </itemspaneltemplate> </groupstyle.panel> </groupstyle> </listbox.groupstyle> </listbox>
Comments
Post a Comment