I am having trouble binding to IsReadOnly
on aDataGridTextColumn
.
<DataGridTextColumn Binding="{Binding Path=OffsetRelative}" IsReadOnly="{Binding IsReadOnly}">
<DataGridTextColumn.HeaderTemplate>
<DataTemplate>
<CheckBox Content="Relative Offset" IsChecked="{Binding ElementName=ViewReportFileUserControl, Path=DataContext.IsSelectedTcfOffsetRelative}" Margin="0,0,10,0"/>
</DataTemplate>
</DataGridTextColumn.HeaderTemplate>
</DataGridTextColumn>
Both OffsetRelative
and IsReadOnly
are public properties in the same class. The Binding to OffsetRelative
works fine but the Binding to IsReadOnly
generates the following run time output:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=IsReadOnly; DataItem=null; target element is 'DataGridTextColumn' (HashCode=2149042); target property is 'IsReadOnly' (type 'Boolean')
Why would one binding work and not the other?