0

I got a DataGrid row index and I now I'd like to get the value of a column id in that row. I tried numerous things not worth mentioning and Google doesn't come up with an answer either.

Any ideas?

Edit: I found this, however, the properties used aren't available in WPF but only WinForms.

Community
  • 1
  • 1
Çan
  • 125
  • 1
  • 2
  • 11

1 Answers1

1

You could access an item in the Items collection of the DataGrid by index and then cast it to your type, e.g.:

int index = 0; //<-- your index
YourClass dataObject = dataGrid.Items[index] as YourClass;
int id = dataObject.Id;
mm8
  • 163,881
  • 10
  • 57
  • 88