As mentioned in my comment, it is possible to focus the grid on a selection modified with behavior. So, you will get that selection will be highlighted:
using System.Windows.Controls; using System.Windows.Interactivity; public class FocusGridOnSelectionChanged : Behavior<DataGrid> { protected override void OnAttached() { base.OnAttached(); AssociatedObject.SelectionChanged += AssociatedObject_SelectionChanged; } private void AssociatedObject_SelectionChanged(object sender, SelectionChangedEventArgs e) { AssociatedObject?.Focus(); } protected override void OnDetaching() { AssociatedObject.SelectionChanged -= AssociatedObject_SelectionChanged; base.OnDetaching(); } } xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" <DataGrid ... > <i:Interaction.Behaviors> <yourbehaviorsns:FocusGridOnSelectionChanged/> </i:Interaction.Behaviors> ... </DataGrid>
But I'm afraid that this is not the complete solution that you need, because if the grid loses focus, the selected elements will lose the selection.
So, if you want, this choice will also be highlighted after the grid loses focus, you must rewrite the DataGridRow control template, namely the visual style "UnfocusedSelected".
Rekshino
source share