Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

row index of DataGridCell

Tags:

c#

wpf

datagrid

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.

like image 997
Blabla Avatar asked Mar 03 '17 12:03

Blabla


1 Answers

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

DataGridRow r2 = DataGridRow.GetRowContainingElement(cell);
int rowindex = r2.GetIndex();
like image 50
Blabla Avatar answered Sep 18 '22 01:09

Blabla