I am binding an object(named Client) with and ObservableCollection(named Contacts) property to my Silverlight view. My Client class has a few string properties on is and the ObservalbeCollection called Contacts. There is a property on my viewmodel named Client(Which implements INotifyPropertyChanged) that contains the Client object. If I bind the ListBox in my view to the ObervableCollection on the object like this:
ItemsSource="{Binding Path=Client.Contacts, Mode=TwoWay}"
and add an Contact item to the collection, the view updates properly and I am shown my newly added Contact. This all works great.
If I create a Contacts property on my ViewModel like this public ObservableCollection Contacts { get { return Client.Contacts; } and bind the ListBox to
ItemsSource="{Binding Path=Contacts, Mode=TwoWay}"
the view is never updated.
I add the Contact item to the Client like this:
Client.Contacts.Add(newContact)
Why doesn't the ListBox of Contacts update? How can I change this so it does? Is the Client.Contacts binding OK to use? Putting a break in the code after adding the new Contact shows that new new Contact object is getting added to the collection but the view is not seeing the addition.