Changes
/* DataTemplate vs. ControlTemplate */
* ControlTemplate is technically used for showing how a specific control can be used; for example, if you want to customize a new template for how a Button should appear. However, it can be used similar to the DataTemplate, with one added bonus; its ContentPresenter sub-control allows for dynamically adding content at every instance, as opposed to a single universal layout that is shared by all.
** For example: The screenshot below shows three areas navigated to by clicking on root objects. Each has a potentially large collection of their own metaclass of children, meaning that each page benefits from filters, but they do not filter the same properties. However, some details are common, such as the item and filter count texts, and the button to remove all filters.
[[File:Templating_ControlTemplate.jpg]]
** The general layout could be created with two columns, one for the counts and button, with the rest of the space dedicated to the individual filters. The template would then be applied one in each of the child areas, with their specific filters nested inside the ContentView used to display the filter.
** During runtime, the <ContentPresenter /> defined in the ControlTemplate will be replaced with whatever content is nested in the ContentView.
{{Hint|An understanding of '''Contexts''' is fundamental to using templates, as this informs what data bindings are directly available. }}
[[Category:Pages with broken file links|XAML Best practices]]
[[Category:XAML|XAML Best practices]]
=== Context Switching ===