<DataGrid x:Name="dataGrid" MouseDown="dataGrid_MouseDown"/>
private void dataGrid_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.RightButton == MouseButtonState.Pressed)
{
var row = DataGridRow.GetRowContainingElement(e.OriginalSource as FrameworkElement);
if (row != null)
{
// dataGrid.SelectedIndex = row.GetIndex();
dataGrid.SelectedItem = row;
}
}
}