<?xml version="1.0" encoding="utf-8" ?>
<ui:BillingPage xmlns="http://xamarin.com/schemas/2014/forms"
                xmlns:r="clr-namespace:Billing.Languages"
                xmlns:ui="clr-namespace:Billing.UI"
                xmlns:v="clr-namespace:Billing.Views"
                xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                x:Class="Billing.Views.IconSelectPage"
                x:Name="iconSelectPage"
                x:DataType="v:IconSelectPage"
                Title="{r:Text IconSelector}"
                BindingContext="{x:Reference iconSelectPage}">

    <ContentPage.Resources>
        <ui:IconConverter x:Key="iconConverter"/>
    </ContentPage.Resources>

    <Grid RowDefinitions="*, Auto">
        <ScrollView>
            <ui:WrapLayout ItemsSource="{Binding IconsSource}" Margin="10">
                <BindableLayout.ItemTemplate>
                    <DataTemplate x:DataType="v:BillingIcon">
                        <Grid WidthRequest="60" HeightRequest="60">
                            <Grid.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding IconCheck, Source={x:Reference iconSelectPage}}"
                                                      CommandParameter="{Binding Icon}"/>
                            </Grid.GestureRecognizers>
                            <Grid BackgroundColor="{DynamicResource PromptBackgroundColor}"
                                  IsVisible="{Binding IsChecked}"/>
                            <ui:TintImage WidthRequest="20" HeightRequest="20" Aspect="AspectFit"
                                          HorizontalOptions="Center" VerticalOptions="Center"
                                          Source="{Binding Icon, Converter={StaticResource iconConverter}}"/>
                        </Grid>
                    </DataTemplate>
                </BindableLayout.ItemTemplate>
            </ui:WrapLayout>
        </ScrollView>
    </Grid>
</ui:BillingPage>