I have ComboBoxone that makes up DataTemplateand I am unable to bind its property IsEnabledto a property IsReadOnlyon the template DataGridTemplateColumn.
I got the following error in VS output window:
IsReadOnly property not found in 'object' '' ContentPresenter '
ComboBox Style:
<Style TargetType="{x:Type ComboBox}" x:Key="ProficiencyColumnComboBoxStyle">
<Setter Property="IsEnabled"
Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},
Path=IsReadOnly, Converter={StaticResource BooleanOppositeConverter}}" />
</Style>
I believe the problem is with how I point RelativeSourceto identify mine DataGridColumn. I tried:
RelativeSource={RelativeSource TemplatedParent}
RelativeSource AncestorType={x:Type DataGridColumn}
RelativeSource AncestorType={x:Type DataGridTemplateColumn}
I tried adding other stylists to this style, and they take effect, so I know that style and DataTemplateapply to controls.
PS
ComboBox DataTemplate DataGrid . , ( ). , .