列のヘッダごとBindしていると、
いまいち分からなくて
データを追加するごとに
grid.Columns[col].GetCellContent(rowObj) as TextBlock
からTextBlockのBackgroundプロパティを変更する、というのをやってみたが、
全く変わらなかった。
データトリガ―をなんとか使えないかなと思って色々試した結果、
AutoGeneratingColumnで、
DataGridTextColumn col = e.Column as DataGridTextColumn;
Style style2 = this.TryFindResource("inputCell") as Style;
col.CellStyle = style2;
XAMLに、
<Style TargetType="DataGridCell" x:Key="inputCell">
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource self}, Path=Content.Text}" Value="IN">
<Setter Property="Background" Value="LightGreen"/>
</DataTrigger>
</Style.Triggers>
</Style>
参考