Last active
December 17, 2015 22:59
-
-
Save kendfrey/5685623 to your computer and use it in GitHub Desktop.
INotifyPropertyChanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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