There are 2 ways to get the automatic notice target object if the source object changed (for example: the value) when you using WPF data binding: the one is Dependency Properties, the other one is INotifyPropertyChanged:
InotifyPropertyChanged sample:
public class IODataPresentation : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string _ValueString;
public string ValueString
{
get { return _ValueString; }
set
{
_ValueString = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ValueString"));
}
}
}
public IODataPresentation() { }
}
DependencyProperties sample:
// Dependency Property
public static readonly DependencyProperty NewValueStringProperty =
DependencyProperty.Register("ValueString", typeof(string),
typeof(UDirectIOBlock), new FrameworkPropertyMetadata(""));
public string NewValueString
{
get { return (string)GetValue(NewValueStringProperty); }
set { SetValue(NewValueStringProperty, value); }
}
About their differences, please read 2 great articles here and here.