Now, it's time to add some resources to the view. In this case, we will be adding a template selector, which we will create later on, and Base64ToImageConverter, which we created earlier. The template selector will look at each row that we will bind to ListView. This will be presenting messages and selecting the best layout template that suits that message:
- Locate the <!-- TODO Add resources --> comment inside the ContentPage.Resources element.
- Add the XAML to the sample as follows, right underneath the comment mentioned in step 1:
<ResourceDictionary>
<selectors:ChatMessageSelector
x:Key="SelectMessageTemplate" />
<converters:Base64ToImageConverter x:Key="ToImage" />
</ResourceDictionary>
This will create one instance of each resource that we've defined and make them accessible to the rest of the view.