I am working with a data grid. When I select a given cell, I want to keep track of the index of the row that cell is on, using the following code:
selectedRows.Clear();
for (int i = 0; i < dataGrid.RowCount; i++)
{
if (dataGrid[column, i].Selected)
{
selectedRows.Add(i);
}
}This works 80% of the time. However, occasionally, when I select the name cell of a row, it highlights the cell blue, which leads me to believe I selected it, but the index is not added to <g class="gr_ gr_32 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" data-gr-id="32" id="32">selectedRows</g>. Is there something I am missing here?
I have checked that the "column" variable is correct.