Data binding is a powerful feature in Silverlight but often you need to bind properties that are not directly the same type. Let’s say we want to have a media player and a slider that works as a seek bar. You can’t directly bind the MediaElement’s Position-property to the sliders value, because they are not the same type. To make the binding work, you would use a converter.
We already saw how to bind XAML-to-XAML, but often you need to bind data from a datasource to your user interface. In this post we’ll see how to bind a collection of items to a ListBox and generate simple templates for each ListBoxItem. We’ll also look at C# and how to define collections and what types of collections should you use when binding data.
We often use different types of data in our applications. That data might come from a database, from the web or a user input. Usually we build our own solution to keep our user interface and the data source synced, with Silverlight we can use databinding to solve those common cases. Data binding is extremely useful on Windows Phone, because of the execution model and tombstoning, that we’ll talk about more soon.