When using data binding in WPF, the target dependency object is updated when it is notified that the source has been changed through the interface INotifyPropertyChanged.
For example:
<TextBlock Text="{Binding Path=SomeField}"/>
The text box will change to correctly reflect the value of SomeField when PropertyChanged(this, new PropertyChangedEventArgs("SomeField"))called from the source.
What if I use the complex path as follows:
<TextBlock Text="{Binding Path=SomeObjField.AnotherField}"/>
Will the text box be updated for PropertyChanged(this, new PropertyChangedEventArgs("SomeObjField"))in the source?
What about PropertyChanged(this, new PropertyChangedEventArgs("AnotherField"))an intermediate object (an object contained in SomeObjField)?
Source objects and fields are NOT objects or dependency properties! Assume property / classes are implemented something like this:
public class Data : INotifyPropertyChanged
{
public string SomeField
{
get { return val; }
set
{
val = value;
}
}
public SubData SomeObjField
{
get { return val; }
set
{
val = value;
}
}
}
public class SubData : INotifyPropertyChanged
{
public string AnotherField
{
get { return val; }
set
{
val = value;
}
}
}