title: "LoadTemplate should not be null" with property ItemTemplate in CollectionView with Xamarin Forms
body: <p>I'm stuck in this problem in first try to use xamarin forms.</p>
  
  <p>I'm trying to set DataTemplateSelector for CollectionView in Xamarin forms but I get this error "LoadTemplate should not be null".</p>
  
  <p>It working without problems if I used ListView.</p>
  
  <p>this is my XAML Code :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                   xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                   xmlns:viewmodel="clr-namespace:JisrWallet.ViewModels"
                   xmlns:common="clr-namespace:JisrWallet.Common"
                   x:Class="JisrWallet.views.Layout.CardsPage"
                   xmlns:views="clr-namespace:SuaveControls.Views;assembly=SuaveControls.FloatingActionButton"
                   BackgroundColor="{StaticResource lightGray}"&gt;
      
          &lt;ContentPage.Resources&gt;
              &lt;ResourceDictionary&gt;
                  &lt;common:IntColorToHexConverter x:Key="colorConverter"/&gt;
                  &lt;common:PrefixValueConverter x:Key="prefixConverter"/&gt;
                  &lt;DataTemplate x:Key="existCardTemplate"&gt;
                      &lt;StackLayout Margin="2"&gt;
                          &lt;Image Source="{Binding StoreImageUrl}" 
                                     Aspect="AspectFill"
                                     HeightRequest="120"
                                     BackgroundColor="{Binding CardColor, Converter={StaticResource colorConverter}}"/&gt;
                      &lt;/StackLayout&gt;
                  &lt;/DataTemplate&gt;
      
                  &lt;DataTemplate x:Key="newCardTemplate"&gt;
                         
                          &lt;StackLayout BackgroundColor="{Binding CardColor, Converter={StaticResource colorConverter}}"&gt;
                              &lt;Label Text="{Binding CardName, Converter={StaticResource prefixConverter}, ConverterParameter=1}"
                                         HeightRequest="120"
                                         HorizontalOptions="Center"
                                         VerticalOptions="Center"
                                         VerticalTextAlignment="Center"
                                         TextColor="White"/&gt;
                              &lt;Label Text="{Binding CardName}" 
                                             FontAttributes="Bold"
                                             BackgroundColor="{Binding CardColor, Converter={StaticResource colorConverter}}"
                                             TextColor="{StaticResource whiteColor}"
                                             HorizontalTextAlignment="Center"/&gt;
                              &lt;BoxView HeightRequest="2" BackgroundColor="White"/&gt;
                          &lt;/StackLayout&gt;
                  &lt;/DataTemplate&gt;
      
                  &lt;common:CardItemTemplateSelector x:Key="cardItemTemplateSelector"
                                                   ExistCardTemplate="{StaticResource existCardTemplate}"
                                                   NewCardTemplate="{StaticResource newCardTemplate}"/&gt;
              &lt;/ResourceDictionary&gt;
          &lt;/ContentPage.Resources&gt;
      
          &lt;StackLayout&gt;
              &lt;StackLayout.BindingContext&gt;
                  &lt;viewmodel:CardsViewModel/&gt;
              &lt;/StackLayout.BindingContext&gt;
      
              &lt;CollectionView x:Name="collectionView" 
                              ItemsSource="{Binding Cards}"
                              ItemTemplate="{StaticResource newCardTemplate}"
                              SelectionMode="Single"
                              SelectionChanged="CollectionView_SelectionChanged"&gt;
                  &lt;CollectionView.ItemsLayout &gt;
                      &lt;GridItemsLayout Orientation="Vertical" Span="2" /&gt;
                  &lt;/CollectionView.ItemsLayout&gt;
              &lt;/CollectionView&gt;
      
      
              &lt;views:FloatingActionButton Image="ic_add_white"
                                          ButtonColor="{StaticResource AccentColor}"
                                          WidthRequest="56"
                                          HeightRequest="56"
                                          HorizontalOptions="End"
                                          VerticalOptions="CenterAndExpand"
                                          Margin="8"
                                          Clicked="FloatingActionButton_Clicked"/&gt;
          &lt;/StackLayout&gt;
      
      &lt;/ContentPage&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I can't figure out the problem. Can anyone help me please ?</p>