Databinding to CLR object problem RRS feed

  • Question

  • I create a textbox in expresion blend and databind it to the CarName field of a class called Car.


    In the C# code I want to change the CarName of the same object so I use this:


                Car car = this._carTextBox.DataContext as Car;

                car.CarName = "New Car Name";


    Yet the textbox still stays blank.

    Tuesday, October 12, 2010 12:34 PM

All replies

  • Your data object (Car) needs to implement INotifyPropertyChanged for the databinding system to notice the change:


    Fortunately it is easy to do.

    Tuesday, October 12, 2010 12:57 PM