Posted By

bokkers on 03/31/09


Tagged

WPF MVVM M-V-VM ViewModel


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


ViewModelBase class


 / Published in: C#
 

This class can be used as a base class for ViewModel-classes used in a MVVM design pattern.

  1. public class ViewModelBase : INotifyPropertyChanged
  2. {
  3. #region INotifyPropertyChanged Members
  4.  
  5. public event PropertyChangedEventHandler PropertyChanged;
  6.  
  7. public void NotifyChanged(string propertyName)
  8. {
  9. if (string.IsNullOrEmpty(propertyName))
  10. throw new ArgumentNullException("propertyName");
  11.  
  12. if (PropertyChanged != null)
  13. PropertyChanged(this, new PropertyChangedEventArgspropertyName));
  14. }
  15.  
  16. #endregion
  17. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ak98 on January 15, 2011

missing a left brace PropertyChangedEventArgs(propertyName));

You need to login to post a comment.