Often, you'll want to display lists of data in your application such as a list of shopping items, a list of users, a list of bank accounts, and so on.
Silverlight textblock binding not updating
We can use data binding to easily bind a collection to a Silverlight control (such as a List Box or Data Grid) and use the same data binding possibilities to defi ne how every item in the collection should be bound. For this recipe, you can fi nd the starter solution in the Chapter02/Silverlight Banking_ Binding_Collections_Starter folder and the completed solution in the Chapter02/Silverlight Banking_Binding_Collections_Completed folder in the code bundle that is available on the Packt website.
In this recipe, we'll create a List Box bound to a collection of activities.
When the Items Source property of the List Box gets set to the Observable Collection of Account Activity, each Account Activity in the collection is evaluated and visualized as defined in the Data Template.
An Observable Collection is the default collection type you'll want to use in a Silverlight application because it's a collection type that implements the INotify Collection Changed interface.
To complete this task, carry out the following steps: The first three steps aren't important for people who have worked with collections before.
A class is created to define the type of items that are held by the collection, which is initialized and then items are added to it.This makes sure that the UI can automatically be updated when the collection is changed (by adding or deleting an item).More on this can be found in the Enabling a Silverlight application to automatically update its UI recipe.The same principle applies for the properties of classes that implement the INotify Property Changed interface.More on this can be found in the same recipe, that is, Enabling a Silverlight application to automatically update its UI.The default collection type to use in Silverlight is Observable Collection. (For more information about this, have a look at the There's more...