I have the following code:
<DataGridTextColumn IsReadOnly="True" Header="StringLock" Binding="{Binding StringLock}">
<DataGridTextColumn.ElementStyle>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="Text" Value="False">
<Setter Property="Background" Value="LightGray"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTemplateColumn Header="CanPressButton">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button>Lock module string</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
The StringLock column Background property’s color is LightGray if the value of the Text it contains is False.
I want to disable the button in column CanPressButton IF the value of Text is False in the StringLock column.
How do I do this?
You have the full
DataContext(i.e. row item) at your disposal to trigger on: