<StyleTargetType="{x:type DataGridCell}"> <style.triggers> <Trigger Property= "IsSelected"Value= "true"> <Setter Property= "Background"Value="{dynamicresource {x:static SystemColors.HighlightBrushKey}}" /> <Setter Property= "Foreground"Value="{dynamicresource {x:static Systemcolors.highlighttextbrushkey}}" /> <Setter Property= "BorderBrush"Value="{dynamicresource {x:static SystemColors.HighlightBrushKey}}" /> </Trigger> <Multidatatrigger> <multidatatrigger.conditions> <ConditionBinding="{Binding IsSelected, Relativesource={relativesource self}}"Value= "True" /> <ConditionBinding="{Binding Iskeyboardfocuswithin, Relativesource={relativesource ancestortype={x:type DataGrid}, mode= FindAncestor}}"Value= "False" /> </multidatatrigger.conditions> <Setter Property= "Background"Value="{dynamicresource {x:static SystemColors.HighlightBrushKey}}" /> <Setter Property= "Foreground"Value="{dynamicresource {x:static Systemcolors.highlighttextbrushkey}}" /> <Setter Property= "BorderBrush"Value="{dynamicresource {x:static SystemColors.HighlightBrushKey}}" /> </Multidatatrigger> </style.triggers> </Style>
WPF, by modifying the DataGrid's cell style, to change the color of the selected row when it loses focus 4.0 is available