This is generally achieved with data binding. If you add a bool
property to your data class, then you can do your complicated conditions in the property setters of the class. In the class, you can change any of the property values dependant on any other value easily. Maybe something like this:
public string Text
{
get { return text; }
set
{
text = value;
NotifyPropertyChanged("Text");
IsEnabled = text == "some value" && otherSomeConditions == true;
}
}
Then you could data bind that to the Checkbox.IsEnabled
property like this:
<DataGrid>
<DataGrid.Columns>
<DataGridTemplateColumn>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Label Name="needToStyleThis" VerticalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="" Width="Auto">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<CheckBox IsEnabled="{Binding IsEnabled}" ... />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>