I am not sure that I fully understand the advantage of binding. For example, if I want to bind a string value to a TextBlock I need to do the following:
- Create a class that extends INotifyPropertyChanged
- Add a string to that class (say: MyString)
- Extend the set method for MyString so that it calls another method (say: OnPropertyChanged)
- Create the OnPropertyChanged method to call the PropertyChangedEventHandler event
Then I need to create a new instance of the class, set my TextBlock.DataContext to point to that class, and finally add the XAML bit for the binding.
Can someone explain the advantage of this over simply setting:
TextBlock.Text = MyString;
Thanks!