I have a number of collection classes that implement their own custom update notification. It should be pretty easy to translate these notifications to an INotifyCollectionChanged
implementation in a proxy class.
INotifyPropertyChanged
is already taken care of; this question is just about collection proxies.
So, what I'm looking for is a way of creating the proxies that is relatively easy to use from XAML. This is particularly true for sub-collections. The custom collection classes are part of a library that cannot be modified (nor derived from). It's also not possible to replace the collection types with INotifyCollectionChanged
-compatible equivalents, because the data-updating code is outside my control.
I'd prefer a solution that works with SL as well, but it's not a strict requirement.
So far, I believe the following approaches are viable:
TypeDescriptionProvider
registered for the collection classes that adds a Proxy
property. This allows Binding paths to dot-into the proxy. It seems that this solution is easiest from a XAML perspective, but is not SL-compatible.I looked into ObjectDataProvider
, but I don't think it can be used in this situation (the proxy creation method must be generic on the type of objects in the container).
Any recommendations on which of these two approaches is better, or any other approaches?
I've decided to move forward with a type converter that is also a MarkupExtension
, as described by this blog post.
MarkupExtension
isn't currently supported by Silverlight, but it will be in v5.