I'm having problem with finding row's and cell's index of a just edited cell in DataGrid
.
I'm using CellEditEnding
event to know when the cell has been edited.
Till now I've managed to do something like this. Col1
contains property DisplayIndex
and that is index of selected column but I can't find in the same way.
private void DataGridData_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
DataGridColumn col1 = e.Column;
DataGridRow row1 = e.Row;
}
I've got it working now. This is how it looks like:
private void DataGridData_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
{
DataGridColumn col1 = e.Column;
DataGridRow row1 = e.Row;
int row_index = ((DataGrid)sender).ItemContainerGenerator.IndexFromContainer(row1);
int col_index = col1.DisplayIndex;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With