wpf - Grid row height ratio based on content -
i have grid 2 rows. in each row there listview. in first row there 100 items , in second row there 500 items. not fit on screen, have scrollbars shown @ each listview (no problem) , row heights should in ratio of heights of listviews. 1* , 5* don't know in advance how big these listboxes be.
note: each item may have different size, use actual listbox height instead of items count
<grid> <grid.rowdefinitions> <rowdefinition /> <!-- keep ratio of rows based on listbox heights --> <rowdefinition /> </grid.rowdefinitions> <listbox grid.row="0"> <!-- 100 items --> </listbox> <listbox grid.row="1"> <!-- 500 items --> </listbox> </grid>
any ideas?
<grid> <grid.rowdefinitions> <rowdefinition height="{binding height,elementname=listbox1}"/> <!-- keep ratio of rows based on listbox heights --> <rowdefinition height="{binding height,elementname=listbox2}"/> </grid.rowdefinitions> <listbox grid.row="0" x:name="listbox1"> <!-- 100 items --> </listbox> <listbox grid.row="1" x:name="listbox2"> <!-- 500 items --> </listbox> </grid>
if have more complex scenarios, can use converter.
Comments
Post a Comment