SHARE
TWEET

BaseViewModel

a guest Jun 16th, 2014 156 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public class BaseViewModel : INotifyPropertyChanged
  2.     {
  3.         public event PropertyChangedEventHandler PropertyChanged;
  4.         protected void OnPropertyChanged(String propertyName)
  5.         {
  6.             PropertyChangedEventHandler handler = PropertyChanged;
  7.             if (handler != null)
  8.             {
  9.                 handler(this, new PropertyChangedEventArgs(propertyName));
  10.             }
  11.         }
  12.  
  13.         protected bool SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
  14.         {
  15.             if (EqualityComparer<T>.Default.Equals(field, value)) return false;
  16.             field = value;
  17.             OnPropertyChanged(propertyName);
  18.             return true;
  19.         }
  20.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top