I know that its not implicitly possible to bind text to a DataGrid header via Dynamically setting the Header text of a Silverlight DataGrid Column, but I was following some code examples online to substitute a TextBlock for the header. However, no matter what I do the text that I've bound to won't show up.
My XML from my 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# from my View Model:
public string KeyListName
{
get { return keyListName; }
set
{
keyListName = value;
raisePropertyChanged("KeyListName");
}
}
I can't figure out what I overlooked.. Thanks in advance for your help!