I have a ListView whose ItemsSource is bound to an ObservableCollection. The collection is filled with "WaypointItem" objects (a small class we defined with the info for the listview)开发者_高级运维.
The WaypointItem is our binding source for each row, but is there any magic way to get a reference to all objects (targets) binding to this class from within the WaypointItem code?
Thanks jason
There might be something helpful in the BindingOperations class. Unfortunately the Target of the binding is probably actually the DataContext of the item presenter (if I understand your description correctly), which means your WaypointItem probably can't tell what may be binding to it.
One slightly off-the-wall possibility would be to implement a custom IValueConverter that notifies your WaypointItem through a well-defined interface that it has been bound to something. It would send this notification on every update, so you would need to handle that appropriately.
精彩评论