<?xml version="1.0" encoding="utf-8"?>

<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:ui="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
    xmlns:local="clr-namespace:InABox.Mobile"
    xmlns:system="clr-namespace:System;assembly=netstandard"
    x:Class="InABox.Mobile.MobileCollectionView"
    BackgroundColor="Transparent"
    x:DataType="local:MobileCollectionView">
    <ContentView.Content>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <RefreshView 
                x:Name="_refresher"
                BackgroundColor="Transparent"
                Grid.Row="0"
                IsEnabled="False">

                <CollectionView  
                    x:Name="_list"
                    BackgroundColor="Transparent" 
                    ItemSizingStrategy="{Binding HasUnevenRows}"
                    SelectionMode="None">
                    <CollectionView.EmptyView>
                        <ui:MaterialLabel 
                            x:Name="_emptylist"
                            Text="{Binding EmptyText}" 
                            VerticalOptions="CenterAndExpand" 
                            VerticalTextAlignment="Center"
                            HorizontalOptions="CenterAndExpand"
                            HorizontalTextAlignment="Center" 
                            TypeScale="H6"
                            TextColor="Gray"/> 
                    </CollectionView.EmptyView>
                    <CollectionView.ItemsLayout>
                        <LinearItemsLayout ItemSpacing="{Binding Spacing}" Orientation="Vertical" />
                    </CollectionView.ItemsLayout>
                </CollectionView>
                
            </RefreshView>
            
            <local:MobileCard
                Grid.Row="1"
                x:Name="_refreshcard"
                Padding="5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                
                    <Label 
                        x:Name="_lastupdate"
                        Grid.Column="0" 
                        HorizontalTextAlignment="Start"
                        FontSize="Micro"
                        TextColor="Black"/>
                
                    <Label
                        x:Name="_numrecords"
                        Grid.Column="1"
                        HorizontalTextAlignment="Center"
                        FontSize="Micro"
                        TextColor="Black"/>
                
                    <Label 
                        x:Name="_pulltorefresh"
                        Grid.Column="2" 
                        HorizontalTextAlignment="End"
                        FontSize="Micro"
                        Text="Pull To Refresh"
                        TextColor="Black"/>
            
                </Grid>    
            </local:MobileCard>
            
        </Grid>
    </ContentView.Content>
</ContentView>