data binding - WPF ListView columns dont update thair width in time -
hi have a listview gridview view
<listview> <listview.view> <gridview.......
and in have few gridviewcolumn's want width of columns size largest item.. not work, seems on databind not update column size instead uses previous databind's largest item..
i have few styles modify layout:
<style targettype="{x:type listview}"> <setter property="borderthickness" value="1.000001"/> <setter property="focusvisualstyle" value="{x:null}"/> <setter property="borderbrush" value="{x:null}"/> <setter property="background" value="transparent"/> </style> <style targettype="listviewitem"> <style.resources> <!-- foreground selected listviewitem --> <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black"/> <!-- background selected listviewitem --> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="transparent"/> <solidcolorbrush x:key="{x:static systemcolors.controlbrushkey}" color="transparent"/> </style.resources> </style> <style targettype="{x:type gridviewcolumnheader}"> <setter property="background" value="{staticresource primarybrush}" /> <setter property="foreground" value="white" /> <setter property="template"> <setter.value> <controltemplate targettype="{x:type gridviewcolumnheader}"> <grid background="{templatebinding background}" snapstodevicepixels="true" margin="2,0"> <rectangle x:name="normal" /> <contentpresenter x:name="headercontent" horizontalalignment="{templatebinding horizontalcontentalignment}" margin="5" recognizesaccesskey="true" snapstodevicepixels="{templatebinding snapstodevicepixels}" verticalalignment="{templatebinding verticalcontentalignment}" /> </grid> </controltemplate> </setter.value> </setter> </style>
does 1 know why wpf behaves way? , there solution?
there seems answer here: force resize of gridview columns inside listview
have had use similar approach on datagrids columns when changing itemssources.
Comments
Post a Comment