using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace RuriLib.ViewModels
{
///
/// A basic viewmodel that implements the PropertyChanged event.
///
public abstract class ViewModelBase : INotifyPropertyChanged
{
/// The event that lets the GUI know a property was changed.
public event PropertyChangedEventHandler PropertyChanged;
///
/// Raises a PropertyChanged event.
///
/// The name of the property. If null, the name of the calling property will be used.
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}