I know multiple inheritence is out, but is there a way to create a wrapper for System.Windows.Point that can inherit from it but still implement bindable dependency properties?<
You may have to reimplement all the classes (Point
, Polygon
, Line
etc.) from scratch, because Point
is a structure, therefore it doesn't support inheritance (which also explains why Point does not support binding: it cannot inherit DependencyObject
, which contains the necessary infrastructure for DPs).
There might be a way though - you could create a subclass of polygon and add a new DependencyProperty
called "BindablePoints
" which would be an observable collection (you would have to create a custom OC that would fire CollectionChanged
when one of the points changed) of the points. The property would in its OnChanged
update the main Points
property of the Polygon
.
I guess this could work, but I'm not sure whether it would be fast enough for whatever you are trying to do. Tou would still have to create subclasses of all the shapes you would want to use, but you wouldn't have to create them all from scratch.