I’m trying to bind FontWeight in datagrid to a property in code and getting a xamlparseexception. This is the code
<sdk:DataGridTextColumn
Header="Date"
CellStyle="{StaticResource ListColumnStyle}"
Binding="{Binding Date}"
FontWeight="{Binding StatusToFont}"
IsReadOnly="True"/>
and the property is defined as
public FontWeight StatusToFont
{
get
{
return FontWeights.SemiBold;
}
}
Anyone sees any issue in this ?
Thanks
A DataGridTextColumn does not support bindings on FontWeight, cause it´s not a DependencyProperty.
A workaraound is to use a DataGridTemplateColumn and specify a TextBox as DataTemplate. On the TextBox you can apply any bindings that are supported on a TextBox.