Blabla
Blabla

Reputation: 377

row index of DataGridCell

I have a DataGrid and on a Click I want to find index of a clicked cell. I found a way to get DataGridCell, and DataGridCellInfo, but there is only column index in it.

How to get row index? I cannot find a way to get it.

Upvotes: 8

Views: 5010

Answers (1)

Blabla
Blabla

Reputation: 377

Found an answer! For the future people who will look for it:

DataGridRow r2 = DataGridRow.GetRowContainingElement(cell);
int rowindex = r2.GetIndex();

Upvotes: 18

Related Questions