tags:

views:

449

answers:

2

I have a business object that implements a collection of PropertyObjects.

BusinessObject SomeCollection Property1Object (Name=Height) Property2Object (Name=Width)

Currently, I am setting the DataContext of UserControl to be the BusinessObject. I've found that I CAN reference into the collection in the binding with something like this, say in a textBox..

UserControl.DataContext = BusinessObject UserControl.TextBlock Text="{Binding Collection[Height].Value}"

Now, at what level can I properly implement INotifyPropertyChanged, even though at the higher level it isn't a property at all.

It's easy enough to see and raise the at the lowest level, the PropertyObject, but is that enough for the binding to work?

Thanks, jeff

+1  A: 

If I'm understanding you correctly, every object in the Collection array has a property called Value, which is what is displayed in the TextBlock in your UserControl. As long as each object in the array implements INotifyPropertyChanged, and fires the event when the value of Value changes, the text in the TextBlock should update (you might need to change the BindingMode to TwoWay as well, I'm not sure though).

Andy
Worked like a charm. Thanks.
jeff
A: 

If you're fake implementing your own collection, you need to implement INotifyCollectionChanged (http://msdn.microsoft.com/en-us/library/system.collections.specialized.inotifycollectionchanged.aspx)

Paul Betts