I have implemented the INotifyPropertyChanged interface like this,
private int total; public event PropertyChangedEventHandler PropertyChanged; public void NotifyPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public int Total { get { return this.Total; } set { if (this.total == value) return; this.total = value; this.NotifyPropertyChanged("TotalCost"); } } I have to bind the value of public int TotalCost to a textbox. The TotalCost would change whenever the value in some other textbox changes. I have done binding dynamically, Binding
bind = new Binding(); bind.Source = this.DataContext; TotalText.SetBinding(TextBox.TextProperty, bind); and setting the DataContext of this class as TotalCost. Where am i wrong? Thanks