The line below works for the TextBox DP Text, where CellNo is a property of a class which derives from INotifyPropertychanged. So here when I change the CellNo the Text will be updated and When I change the CellNo the Text will be updated. This will work fine.
Text="{Binding Path = CellNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
I have create a user control which contain only one TextBox. I have defined one DP name CellValue as below:
public string CellValue
{
get { return (string)GetValue(CellValueProperty); }
set { SetValue(CellValueProperty, value); }
}
// Using a DependencyProperty as the backing store for LimitValue. This enables animation, styling, binding, etc...
public static readonly DependencyProperty CellValueProperty =
DependencyProperty.Register("CellValue", typeof(string), typeof(control), new FrameworkPropertyMetadata
{
BindsTwoWayByDefault = true,
});
Now when I use this user control in any dialog and do the same binding as above, the Target ( TextBox inside User control) is NOT updating.
<local:control
x:Name="control"
CellValue="{Binding Path = CellNo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
Also inside user control I have binded the Text Property of TextBox to CellValue DP.
Inside User control
<TextBox
Text="{Binding Path = CellValue}"
Name="textBox2" />
I want when the CellValue changes the TextBox Text should also be updated, but with the above appoach it remains blank.