File size: 994 Bytes
fab29d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace VersOne.Epub.WpfDemo.ViewModels
{
    /// <summary>
    /// The base class for all view models in this application.
    /// </summary>
    public abstract class ViewModel : INotifyPropertyChanged
    {
        /// <summary>
        /// Occurs when a property value changes.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Triggers the <see cref="PropertyChanged" /> event.
        /// </summary>
        /// <param name="propertyName">
        /// Property name to be supplied for the <see cref="PropertyChanged" /> event.
        /// If this parameter is not set, then the property name of the caller is used.
        /// </param>
        protected void NotifyPropertyChanged([CallerMemberName]string propertyName = "")
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}