Applies to Silverlight 3, 4 and 5
Normally when we ask Silverlight to visualize an object, for example a person or a customer, it will simply display the result of the
ToString() method—which is, of course, a string. This can be seen when we're binding a collection of items to a
ListBox. If we don't specify a value for the
DisplayMemberPath property, we simply see the name of the type (unless we overloaded the
ToString() method). However, it's possible to specify a template called a
DataTemplate, which will be used to visualize an object. It's in fact nothing more than a block of XAML code that gets rendered when an item of a particular type is visualized.
In this recipe, we'll build ...