In VS2017 with Xamarin
In mine app.xaml, I have a MergedDictionary that references a xaml containing my DataTemplate. It is not recognized on the content page. If I move the DataTemplate to app.xaml, it works fine.
How do I get <ResourceDictionary.MergedDictionaries>to recognize the StaticResource defined in CellTemplates.xaml?
My App.xaml:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/CellTemplates.xaml"/>
</ResourceDictionary.MergedDictionaries>
....
My CellTemplates.xaml:
<ResourceDictionary
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<DataTemplate x:Key="CustomerTemplate">
<ViewCell Height="100">
<StackLayout VerticalOptions="FillAndExpand">
....
My content page:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Muffin"
x:Class="Muffin.MainPage">
<ScrollView>
<ListView ItemsSource="{Binding Customers}"
HasUnevenRows="True"
ItemTemplate="{StaticResource CustomerTemplate}">
</ListView>
....
source
share