以下はセル選択時の背景の設定例ですが、実際にセル内をクリックして編集すると色が変わってしまいます。セルが編集されているときのトリガー プロパティはありますか? 背景は変えないでほしいです。
<DataGrid Name="DG1" ItemsSource="{Binding}" SelectionUnit="Cell" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" >
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="SeaGreen"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGrid.CellStyle>
</DataGrid>
私自身の質問に答えると、セルの背景色がに基づいているようですSystemColors.WindowBrushKey
。そのようなリソースをオーバーライドすると、<SolidColorBrush x:Key="{x:Static SystemColors.WindowBrushKey}" Color="Red" />
うまくいきました。`