I have an event on my datagrid BeginningEdit
and I want to determine which cell fired the event. Sender is always the DataGrid, not the cell itself. I need to do this in BeginningEdit
because I have an if statement there that cancels event under specific condition. If specific cell fired the event I want that cell to skip the if statement.
private void XpcbDataGrid_OnBeginningEdit(object? sender, DataGridBeginningEditEventArgs e)
{
foreach (GlobalStructures.StructureTable st in GlobalStructures.Parts.Where(st =>
st.Quantity == (XpcbDataGrid.SelectedItem as GlobalPcbData.Costs)?.Ilosc))
{
foreach (GlobalStructures.Type type in st.Structures.Where(type => type.Grupa == Group))
{
if (type.Typ == "PCB")
e.Cancel = true;
}
}
}
CodePudding user response:
You have the info in e.Column & e.Row