Reputation: 1
I have a third part class object called SomeOnesClass and int property count has only get, I cannot change or extend this class, it doesn't have InotificationChanged implementation, How to get the notification for count value change only with instance of SomeOnesClass.
Upvotes: 0
Views: 196
Reputation: 1036
Try putting SomeOnesClass into another class, use properties to access SomeOnesClass and raise the event in the setter. E.g.
class SomeOnesClassNotification : INotifyPropertyChanged {
public SomeOnesClassNotification(SomeOnesClass someOnesClass) {
this.someOnesClass = someOnesClass;
}
private SomeOnesClass someOnesClass;
private int count;
public int Count {get {return count; }
set {count = value;
NotifyCountChanged();
}
}
void NotifyCountChanged() {
// Do stuff
}
public event PropertyChangedEventHandler PropertyChanged;
}
I'm not too sure of how to implement InotificationChanged, but hopefully this will give you an idea. Note you'd have to use properties or methods to access each of the SomeOnesClass members.
Upvotes: 1