title: a dynamic list in a GridView in Xamarin.Forms
body: <p>I need to do a GridView that receives a list that I don't know and shows it. How can I do that in xamarin forms?
  I need that the layout be repeted like I want, like a template in ListView...In ListView I know How do that but in Grid I don't.
  Isn't there a way to set a ListView appearance to Grid the data?
  I won't know how many rows and columns it will have, because it dependes of the data quantity.</p>
  
  <hr>
  
  <p>My code behind is:</p>
  
  <pre><code> [XamlCompilation(XamlCompilationOptions.Compile)]
  public partial class CategoriasView : ContentPage
  {
      List&lt;Categorias&gt; lstCategorias;
      public CategoriasView()
      {
  
          InitializeComponent();
  
          CallingCategoriasAsync();
  
      }
  
      void eteste()
      {
          int row = 0;
          int column = 0;
          foreach (var item in lstCategorias)
          {
              gridteste.Children.Add(new Label { Text = item.nome }, row, column);
              if (column == 0)
              {
                  column = 1;
              }
              else
              {
                  column = 0;
                  row++;
              }
  
          }
          var i = 0;
      }
  
      async Task CallingCategoriasAsync()
      {
          lstCategorias = await Webservice.GetCategoriasAsync("1242");
          eteste();
  
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My XAML is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="neoFly_Montana.Views.CategoriasView"&gt;
  &lt;ContentPage.Content&gt;
      &lt;StackLayout&gt;
  
              &lt;Grid x:Name="gridteste"&gt;
              &lt;/Grid&gt;
  
      &lt;/StackLayout&gt;
  &lt;/ContentPage.Content&gt;
  </code></pre>
  
  <p></p>
  
  <p>The behind was working when I debbuged it, but nothing is shown on the screen...I think I need to put somenthing in code...</p>