Where should I set Binding TwoWay?
You should set this Mode for TextBox
like this:
<TextBox Text="{Binding Path=Name, Mode=TwoWay}" />
If I'm not mistaken, the Text property is listed TwoWay
mode by default
. Therefore, it's construction is not required.
From MSDN
:
When used in data-binding scenarios, this property uses the default update behavior of
UpdateSourceTrigger.LostFocus
.
This means that updates the properties were visible at once, you need to set the property UpdateSourceTrigger
to PropertyChanged
:
<TextBox Text="{Binding Path=Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
So if I set Binding in ItemSource - is it inherited in TextBox?
No, inheritance will not be, because settings of Binding
unique for each dependency property. Inheritance happens when using DataContext
, but again, settings unique for each property.