Skip to content

Instantly share code, notes, and snippets.

@kendfrey
Last active December 17, 2015 22:59
Show Gist options
  • Save kendfrey/5685623 to your computer and use it in GitHub Desktop.
Save kendfrey/5685623 to your computer and use it in GitHub Desktop.
INotifyPropertyChanged
class Test : INotifyPropertyChanged
{
private string foo;
public string Foo
{
get
{
return foo;
}
set
{
foo = value;
NotifyPropertyChanged();
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
{
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
}
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null)
{
PropertyChanged(this, e);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment