Most business applications contain lists of data items. In earlier user interface technologies, these items were often displayed in a data grid, with each item in a separate row. Other controls used to show lists included list boxes and combo boxes.
These controls didn't have a lot of flexibility on what to show to the user. A Windows Forms ListBox, for example, was restricted to showing a single string for each item. HTML interfaces did a little better, but sophisticated HTML coding was needed for all but the simplest lists.
Displaying lists of data items to the user is an area in which XAML absolutely shines. The developer has exquisite control over what the user will see, and even has capabilities for vary what the user sees depending on various aspects of the data, the role of the user, or many other factors.
The controls in XAML that are designed to work with lists of data items all descend from a base class called ItemControl, and they are often referred to collectively as ItemControls. ItemControls can be bound to a list of data items, so that each item in the list is displayed in the control.
However, ItemControls need a way to declare the aspects of the data that will be shown to the user, and how that information will be laid out. That's the function of a data template.
This section will cover the basics of ItemControls and data templates. For simplicity, most of the content in this section will work with the ListBox control. However, the ...