Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to determine wich cell from datagrid is edited in BeginningEdit event

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;
        }
    }
}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You have the info in e.Column & e.Row

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading