F
F
FAwafawf12122021-06-15 07:04:16
C++ / C#
FAwafawf1212, 2021-06-15 07:04:16

How to get the value from the first cell of the selected row?

I'm making an application in visual studio WPF, connected the database via ADO. I am displaying data in the datagrid, but now I have encountered such a problem that I need to double-click on any cell of any row and automatically the program should determine on which row the cell that I poked is located and take the value from the first field from this row and display. (the first field is a counter, I need to find out the number of this line, on the cell of which the person has poked, in order to do other actions in the future) How can this be solved? what ways besides MVVM

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2021-06-15
@FAwafawf1212

https://docs.microsoft.com/ru-ru/dotnet/api/system...

F
FAwafawf1212, 2021-06-15
@FAwafawf1212

maybe someone will come in handy. Working code

var printertable = NormApparatYchetEntities2.GetContext().PrinterTable.ToList();

            var currentItem = (PrinterTable)((FrameworkElement)sender).DataContext;
            MessageBox.Show(currentItem.IdPrinter.ToString());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question