Using Data Templates

A data template is a piece of user interface that you’d like to apply to an arbitrary object when it is rendered. Many controls have properties (of type DataTemplate) for attaching a data template appropriately. For example, ContentControl and HubSection have a ContentTemplate property for controlling the rendering of its Content object, and ItemsControl has an ItemTemplate that applies to each of its items. Controls with Headers and Footers have HeaderTemplate and FooterTemplate properties to control their appearance. In addition, ComboBox has a SelectionBoxItemTemplate property and ToggleSwitch has OnContentTemplate and OffContentTemplate properties.

By setting one of these properties to an instance of a DataTemplate, you ...

Get Universal Windows® Apps with XAML and C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.