Skip to content

Instantly share code, notes, and snippets.

@andy51002000
Created October 21, 2017 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andy51002000/ac78af189df2fd28289bd61056be5fb7 to your computer and use it in GitHub Desktop.
Save andy51002000/ac78af189df2fd28289bd61056be5fb7 to your computer and use it in GitHub Desktop.
Base class for all ViewModel that implements INotifyPropertyChanged
using System.ComponentModel;
namespace SimpleMVVM.ViewModels
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = PropertyChanged;
if( handler != null)
{
PropertyChangedEventArgs args = new PropertyChangedEventArgs(propertyName);
handler(this, args);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment