We had a situation where we wanted to present a list of items but also have a summary of the number of items in the list displayed in a label. This had to be done in code behind after the data came in and the collection was created. We started out with code (on a form that contained a label called Label1) that looked like this:
dim myColl as new System.Collections.ObjectModel.ObservableCollection(of String)
myColl.add("Hello")
dim b as new binding
b.Source = myColl.Count
Label1.SetBinding(Label.ContentProperty, b)
myColl.add("World")
After this ran Label1 displayed only 1, not the expected count of 2. Immediately we thought that maybe somehow Count wasn't being implemented in a way that notified controls of its update when the second item was added. But then we discovered that you can make this work by declaring your binding differently. Here's code that works:
dim myColl as new System.Collections.ObjectModel.ObservableCollection(of String)
myColl.add("Hello")
dim b as new binding("Count")
b.Source = myColl
Label1.SetBinding(Label.ContentProperty, b)
myColl.add("World")
Now Label1 display's the proper value of 2.
Hopefully this is helpful!
Sean