mvvm - Binding DataGridHeader ContentTemplate in Silverlight -


i know not implicitly possible bind text datagrid header via dynamically setting header text of silverlight datagrid column, following code examples online substitute textblock header. however, no matter text i've bound won't show up.

my xml view:

<dg:datagridtextcolumn binding="{binding path=unitkey}" isreadonly="true">  <dg:datagridtextcolumn.headerstyle>   <style targettype="dataprimitives:datagridcolumnheader">    <setter property="contenttemplate">     <setter.value>     <datatemplate>       <textblock text="{binding path=keylistname}"/>     </datatemplate>     </setter.value>    </setter>   </style>  </dg:datagridtextcolumn.headerstyle> </dg:datagridtextcolumn> 

my c# view model:

    public string keylistname     {         { return keylistname; }         set         {             keylistname = value;             raisepropertychanged("keylistname");         }     } 

i can't figure out overlooked.. in advance help!

put datacontext in textblock

 <textblock datacontext="" text="{binding path=keylistname}"/> 

or

if have same datacontext unitkey

<dg:datagridtextcolumn x:name="dgcolumnunit" binding="{binding path=unitkey}" isreadonly="true"> 

the reason why not binding because parent datagridtextcolumn has been binded already, try debug , take @ output window prompt keylistname cannot found ....


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -