using INotifyPropertychanged in your data object
public class MyObject : INotifyPropertyChanged { string _MyPropertyToBind = string.Empty; public string MyPropertyToBind { get { return _MyPropertyToBind; } set { _MyPropertyToBind = value; NotifyPropertyChanged("MyPropertyToBind"); } } public void NotifyPropertyChanged(string property) { if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs(property)); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion }
you can add the following code to your code
<TextBox Text="{Binding MyPropertyToBind, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
The text field senses the propertychanged event of the datacontext object (MyObjet in our example) and assumes that it is fired when the original data has been updated.
it automatically forcibly updates the control
No need to call yourself UpdateTarget method
Jenzo Oct 11 2018-10-11 21:26
source share