Now, we will add five different templates, each corresponding to a specific message type that the app either sends or receives. Each of these templates goes under the <!-- Resources go here later on --> comment from the code snippet in the previous section.
We won't be explaining each of these templates step by step since the XAML that they contain should be starting to feel familiar to you at this point.
Each template starts the same way: the root element is a DataTemplate with a name. The name is important because we will be referencing it in our code very soon. The content that follows after this element is the actual content that the row will be constructed from.
The bindings inside DataTemplate will also be local to each item or row that CollectionView renders. In this case, it will be an instance of a Message class since we are data binding CollectionView to a collection of Message objects. You will see some StyleClass properties in the...