wpf - Bind width on UI element to Width of another UI Element -


i wanted bind width of column header width of header defined. code doesn't work. if specify width explicitly (width="100"), works fine. can shed light , tell me wrong code below?

<datagrid:datagridtemplatecolumn x:name="pdpcol" width="100">         <datagrid:datagridtemplatecolumn.header>             <grid horizontalalignment="stretch">                 <textblock text="pdp" verticalalignment="center" horizontalalignment="center"                      textwrapping="wrap" width="{binding elementname=pdpcol,path=actualwidth }" textalignment="center" />             </grid>         </datagrid:datagridtemplatecolumn.header> </datagrid:datagridtemplatecolumn> 

remove horizontalalignment="center" textblock or set property stretch. textblock consume available width automatically. furthermore, if don't show else textblock, remove grid , use textblock. need set headertemplate rather header directly.

<datagrid:datagridtemplatecolumn x:name="pdpcol" width="100" header="pdp">     <datagrid:datagridtemplatecolumn.headertemplate>         <datatemplate>             <textblock text="{binding}" textalign="center" />         </datatemplate>     </datagrid:datagridtemplatecolumn.headertemplate> </datagrid:datagridtemplatecolumn> 

best regards,
oliver hanappi


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -