views:

149

answers:

1

As of Silverlight 4 it is possible to data bind against a DependencyObject (instead of a Framework element in previous versions). So far so good, but how do I bind agains a collection of DependencyObjects.

The DataContext is not passed from the ObservableCollection to the collection elements, so that the DependencyProperties of the DependencyObjects are never called (neither the changed events). Neither the DependencyObject offers SetBinding or DataContext to initialize the binding manually.

Thanks for any advice here.

A: 

To get the DataContext to propagate in this case, the DependencyProperty that holds the collection must be of type DependencyObjectCollection. DataContext propagates through DependencyProperties and DependencyObjectCollections.

David.Poll
perfect! thanks a lot!
Meik