Sony
Sony

Reputation: 7196

get Values in a template column in wpf data grid

In my project I have a data grid with three combo box template columns and are data bound to three collections and these columns are editable. The grid is bound to an observable collection, which is used to add new row to the grid like MyCollection.add(new obj("","","")). I tried the foreach method to get values in each template column in each row.But it is not working. Can anyone suggest me a way to loop through and get text in data grid containing template columns

Upvotes: 0

Views: 636

Answers (1)

slimbofat
slimbofat

Reputation: 388

Since everything is data-bound, the best way would be to iterate through the MyCollection instead.

The DataGrid's cell content should really only be a representation of the data in those collections anyway, and it keeps your UI layer thinner.

Upvotes: 1

Related Questions