Hierarchical Data Templates are generally defined as resources, as their in-line XAML becomes very complicated.
Before we convert the existing data template to a hierarchical one, let's move it into a resource and assign it a unique key.
The items in the source collection will form the top level of the tree.
There are two different scenarios that you may or may not want to handle when dealing with data source changes: Changes to the list of items and changes in the bound properties in each of the data objects.
How to handle them may vary, depending on what you're doing and what you're looking to accomplish, but WPF comes with two very easy solutions that you can use: The Observable Collection and the INotify Property Changed interface.
We'll set the Item Template property for the Team Classes to point to another data template resource, this time named, "Team Template".
The template will show a Text Block containing the team name.
This is just as easy, but once you start doing it, you might discover something that disappoints you: Changes are not automatically reflected, like they were in previous examples.