Add starter project for chapter 4

This commit is contained in:
Alvin Ashcraft
2023-05-29 11:43:34 -04:00
parent 5ec4e6e6b4
commit e512a9926c
25 changed files with 861 additions and 0 deletions
@@ -0,0 +1,28 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MyMediaCollection.ViewModels
{
public class BindableBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
protected bool SetProperty<T>(ref T originalValue, T newValue, [CallerMemberName] string propertyName = null)
{
if (Equals(originalValue, newValue))
{
return false;
}
originalValue = newValue;
OnPropertyChanged(propertyName);
return true;
}
}
}