Reputation: 3280
I'm trying to get to grips with some of the nuances of data binding in WPF. I understand that one may specify a source directly on the binding (using Source
, RelativeSource
, etc.) or rely on a DataContext
within the target's object hierarchy such that the first set value of DataContext
encountered traversing the target's ancestors provides the source for any bindings.
What I haven't been able to work out is what happens if the source is not set in some way (i.e. the DataContext
has not been explicitly set anywhere in the target's ancestry and the binding only specifies a Path
).
Path
?(.net 4.5, VS 2012 RC, Win 7 32-bit)
Upvotes: 0
Views: 99
Reputation: 2944
What happens is that your binding doesn't bind to anything. That's not a binding error, since you don't have to set DataContext explicitly (it is inherited from other elements further up the logical tree), so it is perfectly valid to have a control that waits for its DataContext to be set.
Upvotes: 1