Rushui Guan
Rushui Guan

Reputation: 3173

Is there an equivalent of DependencyObjectCollection<T> for WPF .NET4.0?

The class allows the propagations of data context from the collection to its members. But it is only for SilverLight.

More info for DepedencyObjectCollection can be found from this post.

If the equivalent doesn't exist, what's the necessary steps required to create one?

I observe the desire behavior from the RowDefinitionCollection class. But I couldn't figure out its implementation.

thanks

Upvotes: 6

Views: 476

Answers (1)

Rushui Guan
Rushui Guan

Reputation: 3173

The short answer is NO.

But I no longer think it is the correct implementation anyway. I end up using a collection of FrameworkElement and add them into the LogicalChildren of the custom control. By doing so, DataContext are passed on to the FrameworkElement naturally and everything works as expected.

It seems that that's how RowDefinition class is implemented in .NET 4.0. However, Silverlight version of RowDefinition is derived from DependencyObject directly. The MSDN document shows Silverlight documentation by default and misdirected me to the older and incorrect approach.

Upvotes: 2

Related Questions