xml - Updating listview height to fill new form content (c#) -
i have form border contains listview, within c# code height of border changed depending on value. right border height changes no problem how can update listview have same height border? here xml:
<datatemplate x:key="packagetemplate"> <border x:name="packageborder" borderbrush="black" borderthickness="2" margin="10" padding="0" width="100" > <border.style> <style> <style.triggers> <datatrigger binding="{binding path=status}" value="1"> <setter property="border.background" value="#ff999696"/> </datatrigger> <datatrigger binding="{binding path=status}" value="0"> <setter property="border.background" value="#ffe4e4e4"/> </datatrigger> <datatrigger binding="{binding path=layout}" value="0"> <setter property="border.height" value="100"/> </datatrigger> <datatrigger binding="{binding path=layout}" value="1"> <setter property="border.height" value="200"/> </datatrigger> </style.triggers> </style> </border.style> <grid> <grid.rowdefinitions> <rowdefinition height="70"/> <rowdefinition height="*"/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition width="auto"/> </grid.columndefinitions> <listview grid.row="0" grid.column="0" background="{x:null}" x:name="list" itemssource="{binding path=collection}" itemtemplate="{dynamicresource chiptemplate}" scrollviewer.horizontalscrollbarvisibility="disabled" scrollviewer.verticalscrollbarvisibility="disabled" borderthickness="0" borderbrush="{x:null}" foreground="black" verticalalignment="top" width="90" > <listview.itemspanel> <itemspaneltemplate> <wrappanel orientation="horizontal" verticalalignment="center" /> </itemspaneltemplate> </listview.itemspanel> </listview> <label grid.row="1" grid.column="0" content="{binding path=location}" fontsize="15" fontfamily="arial" foreground="black" background="{x:null}" verticalalignment="bottom" horizontalalignment="left"></label> </grid> </border> </datatemplate>
in xaml
have set listview height 70 setting <rowdefinition height="70"/>
, width 90, listview
not bigger that, need set <rowdefinition height="70*"/>
allow grow in height , remove width="90", or perhaps use dockpanel
.
<dockpanel> <label dockpanel.dock="bottom" content="{binding path=location}" fontsize="15" fontfamily="arial" foreground="black" /> <listview x:name="list" itemssource="{binding path=collection}" itemtemplate="{dynamicresource chiptemplate}" scrollviewer.horizontalscrollbarvisibility="disabled" scrollviewer.verticalscrollbarvisibility="disabled" borderthickness="0" borderbrush="{x:null}" foreground="black" > <listview.itemspanel> <itemspaneltemplate> <wrappanel orientation="horizontal" verticalalignment="center" /> </itemspaneltemplate> </listview.itemspanel> </listview> </dockpanel>
Comments
Post a Comment