Skip to content

Instantly share code, notes, and snippets.

@mr5z
Last active May 23, 2019 15:04
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 mr5z/cdb248d82908b68be88cda9e6a388942 to your computer and use it in GitHub Desktop.
Save mr5z/cdb248d82908b68be88cda9e6a388942 to your computer and use it in GitHub Desktop.
// This assumes you are using PropertyChanged.Fody
class ViewModel : INotifyPropertyChanged
{
public bool Enabled { get; set; }
// more properties
protected void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
switch (e.PropertyName)
{
case nameof(Enabled):
HandleEnabledChanged();
break;
}
}
void HandleEnabledChanged()
{
Service.Record(Enabled);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment