wpf - How to change text of a DataGridColumnHeader -


i have following text column defined, , want programmatically replace text in 3 text blocks. appreciated.

<datagridtextcolumn     x:uid="expiration_datagridtextcolumn"     binding="{binding expiration}">     <datagridcolumn.headerstyle>         <style             targettype="datagridcolumnheader"             basedon="{staticresource threelinecolumnheaderstyle}">             <setter                 property="contenttemplate">                 <setter.value>                     <datatemplate>                         <stackpanel>                             <textblock                                 x:uid="expiration_header_line1"                                 text=""                                 horizontalalignment="center" />                             <textblock                                 x:uid="expiration_header_line2"                                 text="expriation"                                 horizontalalignment="center" />                             <textblock                                 x:uid="expiration_header_line3"                                 text=""                                 horizontalalignment="center" />                         </stackpanel>                     </datatemplate>                 </setter.value>             </setter>         </style>     </datagridcolumn.headerstyle> </datagridtextcolumn> 

you can bind text of vm properties using relative source binding.

you should override headertemplate rather style,

<datagridtextcolumn x:uid="expiration_datagridtextcolumn" binding="{binding expiration}">                 <datagridcolumn.headertemplate>                         <datatemplate>                             <textblock text="yourcolumnname" horizontalalignment="center"></textblock>                         </datatemplate>                 </datagridcolumn.headertemplate>             </datagridtextcolumn> 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -