I have a class of type TEntity which is bound to a View:
public class TEntity
{
private string _name;
public string Name
{
get {return _name;}
set {_name = value; NotifyPropertyChanged("Name");}
}
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
if(PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
I have not subscribed to PropertyChanged event anywhere in my code, but whenever I change the value of Name property an event handler gets subscribed to PropertyChanged event. I have not created any handler in my code. How is that handler created and subscribed appropriately?