Last active
March 10, 2017 21:32
-
-
Save JayBazuzi/ae5bd627269cb00ceaa9f9c3d3294dea to your computer and use it in GitHub Desktop.
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
public class MyViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged = delegate {}; | |
string _name; | |
public string Name | |
{ | |
get { return _name; } | |
set | |
{ | |
if (_name == value) return | |
_name = value; | |
PropertyChanged(this, new PropertyChangedEventArgs("Name")); | |
} | |
} | |
} |
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
public class MyViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged = delegate {}; | |
string _name; | |
public string Name | |
{ | |
get { return _name; } | |
set | |
{ | |
if (_name == value) return | |
_name = value; | |
RaiseNotifyPropertyChanged(); | |
} | |
} | |
void RaiseNotifyPropertyChanged([CallerMemberName]string propertyName = null) | |
{ | |
PropertyChanged(this, new PropertyChangedEventArgs("Name")); | |
} | |
} |
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
public class MyViewModel : NotifyPropertyChanged | |
{ | |
string _name; | |
public string Name | |
{ | |
get { return _name; } | |
set | |
{ | |
if (_name == value) return | |
_name = value; | |
RaiseNotifyPropertyChanged(); | |
} | |
} | |
} | |
// This is utility code that you could share with the world. | |
abstract class NotifyPropertyChanged : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged = delegate {}; | |
void RaiseNotifyPropertyChanged([CallerMemberName]string propertyName = null) | |
{ | |
PropertyChanged(this, new PropertyChangedEventArgs("Name")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment