I need to attach a notify change event to an encapsulated parameter in an external class. I usually would implement INotifyPropertyChanged
, but I can't edit the external class. What is the right approach for this problem?
That will be very hard to do. The best option seems to be deriving that class, but you need all properties to be marked virtual
. When you have no control over the class that seems to be unlikely.
If you are the only one calling that class, you could also create a wrapper that mimics that class' behavior. You could create properties yourself and implement INotifyPropertyChanged
. You can't get notified on changed to the inner object though.
If that is your best option, you could also implement a implicit conversion operator so you can pass in your class like it was the class you are wrapping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With