Reputation: 125
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.
Upvotes: 0
Views: 752
Reputation: 169270
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;
Upvotes: 1