title: How to set `ListView` height automatically depending on the number of items in `Xamarin Forms`?
body: <p>I am <code>ListView</code> to display items on my screen. The items I display varies in count. So my question is: how can I set the height of my <code>ListView</code> automatically depending on the number of items? Right now I have my <code>ListView</code> occupying my screen all the way to the bottom like the picture below. </p>
  
  <p><a href="https://i.stack.imgur.com/Uq7vo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Uq7vo.png" alt="enter image description here"></a></p>
  
  <p>I want it to look like the image below (which uses a <code>TableView</code>):</p>
  
  <p><a href="https://i.stack.imgur.com/hbTSZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hbTSZ.png" alt="enter image description here"></a></p>
  
  <p>PS: I am working on a PCL application but open to create renderers. At the moment I'm just working on the PCL and iOS side, so iOS renderers is much appreciated.</p>
  
  <p><strong>Edits: Additional XAML code:</strong></p>
  
  <pre><code>&lt;ListView x:Name="categoryGroupListView" ItemTapped="openCategoriesPage" HasUnevenRows="true"&gt;
      &lt;ListView.Header&gt;
          &lt;StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"&gt;
              // Header code here
          &lt;/StackLayout&gt;
      &lt;/ListView.Header&gt;
      &lt;ListView.ItemTemplate&gt;
          &lt;ListView.DataTemplate&gt;
              &lt;TextCell Text="{Binding CategoryName}" Detail="{Binding Count}"/&gt;
          &lt;/ListView.DataTemplate&gt;
      &lt;/ListView.ItemTemplate&gt;
  &lt;/ListView&gt;
  </code></pre>