Say, for example, I have a ListBox. The ListBox has it's ItemsSource bound to some data object behind the scenes. Is it possible to change the actual value of a data item behind the scenes by changing it's associated bound ListBoxItem content/text?
I would think that in theory two-way binding would work here ... but some preliminary tests seem to not be working. Am I missing something, or is two way binding not applicable in this case?
You have to implement INotifyPropertyChanged in your model object and raise NotifyPropertyChanged from the properties of your model. It is the way that WPF listen changes.http://weblogs.asp.net/marianor/
Hi Mariano - that's a good point, however I unfortunately don't have access to the underlying data model that drives the ItemsSource. This is a custom control I'm building that builds off a ListBox. So I know the ItemsSource, but users of the control actually provide the data object behind the scenes which I have no idea about.
You can make a wrapper over that class and raise the property changed. Other option is refresh the binding when you know you have a change.http://weblogs.asp.net/marianor/