I have a ViewModelBase class where I define RaisePropertyChanged method for the INotifyPropertyChanged interface. Most MVVM people are pretty familiar with this.
I also have a Validating ViewModel that inherits from ViewModelBase. It implements a interface and some methods to validate it’s properties. It has a IsValid property the is only a getter who checks if there are any rule violations. However if I would wan’t to bind to this property in the Views it would have to get updated at some time. This would basicly be everytime some other property is changed, or at least properties that I validate against. One simple solution would be to just Notify IsValid inside the RaisePropertyChanged method but it is defined in ViewModelBase where IsValid hasn’t been defined.
Would any of you have a good solution for this dilemma?
If you are following the standard event handling pattern, your
RaisePropertyChangedmethod will be marked asvirtual(it should probably be aprotected virtualmethod), so you’ll be able to override that method in your validating view model, call the base implementation, and then invoke thePropertyChangedevent for theIsValidproperty.I’m not quite sure what you are doing, but if it is general validation, you would be better off using a framework such as DataAnnotations.