Ok, I saw this code for this:
<DataGrid.RowStyle> <Style TargetType="DataGridRow"> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="Black"/> <Setter Property="Foreground" Value="Green"> </Setter> </Trigger> </Style.Triggers> <Setter Property="Background"> <Setter.Value> <MultiBinding Converter="{StaticResource ucComponentesColorFilaMultiValueConverter}"> <Binding ElementName="dgdComponentes" Path="ItemsSource" /> <Binding ElementName="dgdComponentes" Path="SelectedItems" /> <Binding ElementName="CurrentItem" /> </MultiBinding> </Setter.Value> </Setter> </Style> </DataGrid.RowStyle>
Indeed, the code is a style trigger, the setter property for other cases, but I add that the code of this can affect the result.
I would like to change the selected background of the string, which is blue by default, and I want a different color according to some conditions. For example, if a register is added, then if I select a row, it will be green; if this row is not selected, it will be light green.
I can change the color of the lines as I want, but when I select it, it will always be blue.
Thanks.
source share