You can use this helper method to get the row index:
public static class DataGridHelper
{
static public int GetRowIndex(DataGrid dataGrid, DataGridCellInfo dataGridCellInfo)
{
DataGridRow dgrow = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(dataGridCellInfo.Item);
if (dgrow != null)
return dgrow.GetIndex();
return -1;
}
}
Use it like this in the appropriate events:
int rowIndex = DataGridHelper.GetRowIndex(yourDataGrid, yourDataGrid.SelectedCells[0]);