如何确定在 BeginningEdit 事件中编辑了数据网格中的哪个单元格
How to determine which cell from datagrid is edited in BeginningEdit event
我的数据网格上有一个事件 BeginningEdit
,我想确定哪个单元格触发了该事件。发件人始终是 DataGrid,而不是单元格本身。我需要在 BeginningEdit
中执行此操作,因为我有一个 if 语句可以在特定条件下取消事件。如果特定单元格触发了事件,我希望该单元格跳过 if 语句。
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;
}
}
}
您有 e.Column & e.Row
中的信息
我的数据网格上有一个事件 BeginningEdit
,我想确定哪个单元格触发了该事件。发件人始终是 DataGrid,而不是单元格本身。我需要在 BeginningEdit
中执行此操作,因为我有一个 if 语句可以在特定条件下取消事件。如果特定单元格触发了事件,我希望该单元格跳过 if 语句。
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;
}
}
}
您有 e.Column & e.Row
中的信息