Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Is there any documentation no how to build a custom GridView?

$
0
0

I'm trying to use the Grid like an MvxGridView whereby I can Bind to a Collection, and set a Template.

Ideally, this can all be done in Xaml. Here's my pseudo code example.

  <GridView
    x:Name="MyGrid"
    ItemsSource="{Binding MyCollection}"
    Columns ="2">
    <!-- Since Row's isn't defined, it will generate the RowDefinitions based on the MyCollection.Count / Columns -->
    <GridView.ColumnDefinitionTemplate>
      <ColumnDefinition Width="*" />
    </GridView.ColumnDefinitionTemplate>
    <GridView.RowDefinitionTemplate>
      <RowDefinition Height="Auto" />
    </GridView.RowDefinitionTemplate>
    <GridView.ItemTemplate>
      <DataTemplate>
        <ViewCell>
          <ViewCell.View>
            <StackLayout Orientation="Vertical">
              <Label Text="{Binding Title}" />
            </StackLayout>
          </ViewCell.View>
        </ViewCell>
      </DataTemplate>
    </GridView.ItemTemplate>
  </GridView>

Is there an example on how to do this? Or better yet, does something like this already exist :) ?

Might even be nice to have this in the X-Forms Toolkit


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>