Currently I have use the following approach to setup change notification on any of my properties that I bind to in xaml:
class MyClass : INotifyPropertyChanged
{
string name;
public string Name
{
get { return name; }
set
{
name = value;
NotifyPropertyChanged("Name");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
However, I've seen that to implement a dependency property I need to do stuff like registering it and setting callbacks etc, which in turn will just end up calling the above code.
So what's the point of setting all the extra boiler plate stuff for dependency properties when I can just use the above approach?
Thanks.