This project is read-only.

Minor ViewModelBase modification

Nov 5, 2010 at 1:51 PM


it would be very helpful, if you could change the viewmodel base classes to something like below to allow overriding the event handling

(it would not break existing code):

   public abstract class ViewModelBase
 : INotifyPropertyChanged

#region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void NotifyPropertyChanged<T>(Expression<Func<T>> propertySelector)
            Guard.ArgumentNotNull(propertySelector, "propertySelector");
            OnPropertyChanged(thisnew PropertyChangedEventArgs(PropertyChangedExtensions.GetPropertyName(propertySelector))); // CHANGE


// NEW
        protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
            if (PropertyChanged != null)
                PropertyChanged(sender, e);


please keep up the good work!
Nov 5, 2010 at 9:14 PM

Thanks.. and ya, I suppose I can do this - though I think I should forgo the sender parameter on OnPropertyChanged because it will/should always be "this".