Binding in a WPF data grid text column

Jared's answer is correct, but I've found a concrete solution that's solved my problem.

http://blogs.msdn.com/vinsibal/archive/2008/12/17/wpf-datagrid-dynamically-updating-datagridcomboboxcolumn.aspx

Following this example, I changed my DataGridTextColumn definition to:

<dg:DataGridTextColumn Binding="{Binding Font.Name}" IsReadOnly="True" Header="Font">
    <dg:DataGridTextColumn.ElementStyle>
        <Style TargetType="TextBlock">
            <Setter Property="FontFamily" Value="{Binding Font.Name}" />
        </Style>
    </dg:DataGridTextColumn.ElementStyle>
</dg:DataGridTextColumn>

And I don't need to worry about the column inheriting the DataContext. This gives me the result I want.


Try

TextBlock.FontFamily="{Binding Font.Name}"

Sometimes the binding system has a problem finding where a property is declared so you need to give it some help.