Issue
This Content is from Stack Overflow. Question asked by afreeman
According to the picture shown
enter image description here
the color of the selected row does not appear over the cells that have been changed color by Style, but appears in the cells that have not been colored by style
i wanna set it over the cells that have been changed color by Style
<DataGridTextColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}" >
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<CheckBox x:Name="C8" Click="CHECK_CLICK" Style="{DynamicResource CheckBoxStyle1}" IsEnabled="{Binding Converter={StaticResource IsEnabled_Cell},ConverterParameter=C8}" IsChecked="{Binding From_7_To_8,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="12" Content=" 7 --- 8 " HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FlowDirection="LeftToRight" HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
</CheckBox>
</DataTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<!--<DataTrigger Binding="{Binding Path=Content.IsChecked, RelativeSource={RelativeSource Self}}" Value="false" >
<Setter Property="Background" Value="{x:Null}"/>
</DataTrigger>-->
<DataTrigger Binding="{Binding Order_Life_7_8,Mode=TwoWay}" Value="0">
<Setter Property="Background" Value="{Binding RelativeSource={RelativeSource Self}}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Order_Life_7_8,Mode=TwoWay}" Value="1">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding Order_Life_7_8,Mode=TwoWay}" Value="2">
<Setter Property="Background" Value="GreenYellow"/>
</DataTrigger>
<DataTrigger Binding="{Binding Order_Life_7_8,Mode=TwoWay}" Value="3">
<Setter Property="Background" Value="Yellow"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.CellStyle>
</DataGridTextColumn>
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.