<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:telerikDataControls="clr-namespace:Telerik.XamarinForms.DataControls;assembly=Telerik.XamarinForms.DataControls"
             xmlns:listView="clr-namespace:Telerik.XamarinForms.DataControls.ListView;assembly=Telerik.XamarinForms.DataControls"
             xmlns:viewModels="clr-namespace:ListViewTemplateCellDemo.Portable.ViewModels;assembly=ListViewTemplateCellDemo.Portable"
             x:Class="ListViewTemplateCellDemo.Portable.StartPage">

    <ContentPage.Padding>
        <OnPlatform x:TypeArguments="Thickness">
            <On Platform="iOS" Value="0,20,0,0"/>
        </OnPlatform>
    </ContentPage.Padding>

    <ContentPage.BindingContext>
        <viewModels:StartPageViewModel />
    </ContentPage.BindingContext>
    <Grid>
        <telerikDataControls:RadListView x:Name="listView"
                                         ItemsSource="{Binding Source}" 
                                         SelectionMode="None"
                                         ItemTapped="ListView_OnItemTapped">
            <!-- See for details http://docs.telerik.com/devtools/xamarin/controls/listview/cells/listview-cells#listviewtemplatecell-example  -->
            <telerikDataControls:RadListView.ItemTemplate>
                <DataTemplate>
                    <listView:ListViewTemplateCell>
                        <listView:ListViewTemplateCell.View>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>

                                <StackLayout Orientation="Horizontal" Margin="10, 10, 10, 0">
                                    <Label Text="{Binding Title}" FontSize="16" FontAttributes="Bold" TextColor="Black" VerticalOptions="Center" />
                                </StackLayout>
                                <StackLayout IsVisible="{Binding ShowDetails}" Orientation="Horizontal" Grid.Row="1" Margin="10, 0, 10, 10">
                                    <Label Text="by" FontSize="13" FontAttributes="Italic" TextColor="Gray" />
                                    <Label Text="{Binding Author}" FontSize="13" FontAttributes="Italic" TextColor="Gray" />
                                </StackLayout>
                            </Grid>
                        </listView:ListViewTemplateCell.View>
                    </listView:ListViewTemplateCell>
                </DataTemplate>
            </telerikDataControls:RadListView.ItemTemplate>
        </telerikDataControls:RadListView>
    </Grid>
</ContentPage>