<?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:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
             x:Class="inutralia.Views.ModalFiltersRecipe"
             x:Name="modalFiltersRecipe"            
             BackgroundColor="{DynamicResource BasePageColor}"
             Title="Recetas">

    <StackLayout Padding="20" VerticalOptions="FillAndExpand">

        <StackLayout VerticalOptions="Start" Orientation="Horizontal" Padding="0,0,0,10">
            <Entry HorizontalOptions="FillAndExpand" Text="{Binding Desc}" Placeholder="Introduzca búsqueda" />
        </StackLayout>

        <ListView ItemTapped="ItemTapped" 
                  ItemsSource="{Binding Groups}"              
                  Footer=""
                  HasUnevenRows="True"
                  IsGroupingEnabled="True">

            <ListView.GroupHeaderTemplate>
                <DataTemplate>
                    <ViewCell>
                        <StackLayout BackgroundColor="{DynamicResource ComplementColor}" Padding="15,5,15,5">
                            <Label Text="{Binding Name}" TextColor="White" />
                        </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.GroupHeaderTemplate>

            <ListView.ItemTemplate>
                <DataTemplate>
                    <SwitchCell Text="{Binding Name}" On="{Binding Selected}"  />
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

        <artina:Button x:Name="applyButton"
                       Grid.Row="1"
                       HorizontalOptions="{ artina:OnOrientationLayoutOptions
						                PortraitPhone=Fill,
						                LandscapePhone=Center,
						                PortraitTablet=Fill,
						                LandscapeTablet=Center} "
                       VerticalOptions="End"
                       Clicked="ApplyModalButton"                        
                       Style="{DynamicResource PrimaryActionButtonStyle}"                         
                       Text= "Aplicar"/>
    </StackLayout>
</ContentPage>