Hi, i'm a WPF newbie. I'm trying to learn it as a matter of fact :-)

If you have binding between a textbox.text and the name property of your employee class, then you have to add code if you want the textbox.text property to be updated when another process changes the name property. You can do this by letting the employee class implement the INotifyPropertyChanged and let the binded properties know Name has changed.

You can also do this by letting the Employee class inherit from DependencyObject. If you then use the SetValue in your Name property, you get the same effect as with notifypropertychanged.

Now my question: what is then the difference between the 2 (i know you have extra capabilities with DependencyProperties, zo when should you use notifyPropertyChanged?) Here i have the code that does 2 times the same, but in a different way:

class Employee : INotifyPropertyChanged
{
private string name;

public string Name
{
get { return name; }
set {
this.name = value;
this.NotifyPropertyChanged("Name");// Notify others }
}

#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged(string name)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
#endregion


OR:

class Employee : DependencyObject
{
private string name;

public static readonly DependencyProperty NameProperty =
DependencyProperty.Register("Name", typeof(string), typeof(Employee));

public string Name
{
get { return (string) GetValue(NameProperty); }
set {
SetValue(NameProperty, value);
}
}

}