Reputation: 33
I have a List<T>
collection which is bound to a DataGrid. T
is some class with some public properties, all have PropertyChangedEventHandler defined in order to update the grid properly, everything works just great. The only problem is that I don't know how to get reference to a row, to which my collection entry is bound.
For example:
List<T> collection = new List<T>();
// List has been filled with <T> objects
How can I determine to which DataGrid row (or cell), collection[23] object is bound to? How can I return reference to this row?
Thanks a lot for your help!!!
Upvotes: 2
Views: 1103
Reputation: 33
I used the ItemContainerGenerator.ContainerFromItem(binded_object)
method of my DataGrid instance as Rachel suggested and got the actual DataGridRow reference, that was exactly what I needed.
Upvotes: 1