Unique styles for target / current row and selected rows in WPF DataGrid

I am trying to style the whole / current row differently than the selected rows in the WPat datagrid, but cannot find an elegant way to do this. The closest I came up with is to use "IsKeyboardFocusWithin", but it disappears when the Datagrid itself loses focus. I would like to somehow learn from the style if the line is the one that contains CurrentCell, and based on this it will change the background color. Is there any way to do this? Here is my current implementation using "IsKeyboardFocusWithin"

<Style x:Key="PlaylistDataGridRowStyle"
       TargetType="{x:Type DataGridRow}">
    <Style.Triggers>            
        <Trigger Property="IsSelected"
                 Value="True">
            <Setter Property="Background"
                    Value="#CB88AACD" />                
        </Trigger>
        <Trigger Property="IsKeyboardFocusWithin"
                 Value="True">
            <Setter Property="Background"
                    Value="#FF88AACD" />
        </Trigger>
    </Style.Triggers>
    <Setter Property="Background"
            Value="Transparent" />
    <Setter Property="BorderThickness"
            Value="0" />
</Style>
+3
source share

All Articles