title: Issues with Xamarin Forms 4 (pre 4) using CollectionView in UWP project
body: <p>I'm facing some tricky bugs while trying to use the new CollectionView
  feature implemented in Xamarin Forms 4. On the <code>Android</code> project it works very
  well after enabling experimental features in MainActivity.cs with:</p>
  
  <pre><code>global::Xamarin.Forms.Forms.SetFlags(new[] { "CollectionView_Experimental", "Shell_Experimental" });
  </code></pre>
  
  <p>But <code>xamarin</code> documentation doesn't provide any information about UWP project
  so first when I tried to compile the UWP project, it throws me this exception
  when it tries to render a page that uses CollectionView</p>
  
  <blockquote>
    <p>System.InvalidOperationException:</p>
    
    <p>'The class, property, or method you are attempting to use ('VerifyCollectionViewFlagEnabled')
    is part of CollectionView; to use it, you must opt-in by calling Forms.SetFlags("CollectionView_Experimental")
    before calling Forms.Init().'</p>
  </blockquote>
  
  <p>So I tried to call the SetFlags in App.xaml.cs in UWP project before calling
  InitializeComponent() method. So this time it throws me this exception when
  it tries to load the page containing <code>CollectionView</code>:</p>
  
  <blockquote>
    <p>System.NullReferenceException: 'Object reference not set to an instance of an object.'</p>
  </blockquote>
  
  <p>So like in this example:</p>
  
  <pre><code>await Navigation.PushAsync(new PageWithCollectionView());
  </code></pre>
  
  <p>The exception is thrown after successful execution of PageWithCollectionView constructor.</p>
  
  <p>Can somebody help me to solve this problem?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p></p>
  
  <p>Ok, so adding the SetFlags in App.xaml.cs in UWP project works and
  the CollectionView gets initialized correctly. But the NRE is still there
  (on Android the CollectionView works without problems), while trying to get
  rid of this problem I noticed that it's caused when I try to nest the XAML layout this way:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;CollectionView SelectionMode="Single"&gt;
      &lt;CollectionView.ItemsLayout&gt;
          &lt;GridItemsLayout Orientation="Horizontal"
                           Span="2"/&gt;
      &lt;/CollectionView.ItemsLayout&gt;
      &lt;CollectionView.ItemTemplate&gt;
          &lt;DataTemplate&gt;
              &lt;Grid&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition/&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition/&gt;
                  &lt;/Grid.RowDefinitions&gt;
                  &lt;StackLayout Orientation="Vertical"
                               Grid.Column="0"
                               Grid.Row="0"&gt;
                      &lt;Label Text="{Binding Title}"/&gt;
                  &lt;/StackLayout&gt;
              &lt;/Grid&gt;
          &lt;/DataTemplate&gt;
      &lt;/CollectionView.ItemTemplate&gt;
  &lt;/CollectionView&gt;
  </code></pre>
  
  <p>If I remove all the DataTemplate from CollectionView.ItemTemplate, just
  leaving it blank like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;CollectionView SelectionMode="Single"&gt;
      &lt;CollectionView.ItemsLayout&gt;
          &lt;GridItemsLayout Orientation="Horizontal"
                           Span="2"/&gt;
      &lt;/CollectionView.ItemsLayout&gt;
      &lt;CollectionView.ItemTemplate&gt;
      &lt;/CollectionView.ItemTemplate&gt;
  &lt;/CollectionView&gt;
  </code></pre>
  
  <p>The page gets rendered a <code>CollectionView</code> shows ItemSource elements with messy
  layout (without margin and padding, and calling <code>ToString()</code> method of element
  to visualize it inside the cell).</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>After update to <code>Xamarin Forms</code> 4 pre 8, the exception is gone.</p>