<?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:local="clr-namespace:InABox.Mobile"
             x:Class="InABox.Mobile.MobileSearchBar"
             BackgroundColor="Transparent">
    
    <ContentView.ControlTemplate>
        
        <ControlTemplate x:DataType="local:MobileSearchBar">

            <Grid BackgroundColor="Transparent" Margin="0">
                
                <local:MobileCard
                    Padding="3" 
                    BackgroundColor="{TemplateBinding TextBackgroundColor}"
                    BorderColor="{TemplateBinding BorderColor}"
                    IsClippedToBounds="True"
                    HeightRequest="40">
                    
                    <Grid 
                        HorizontalOptions="Fill" 
                        BackgroundColor="Transparent" 
                        ColumnSpacing="0">
                        
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        
                        <Image
                            Source="search" 
                            BackgroundColor="{TemplateBinding BackgroundColor}"
                            Grid.Column="0" 
                            HeightRequest="25"
                            WidthRequest="25"
                            Margin="5"
                            VerticalOptions="Center"
                            HorizontalOptions="Center"
                        />
                        
                        <local:MobileEntry
                            x:Name="_search"
                            Grid.Column="1"
                            HorizontalOptions="Fill"
                            PlaceholderColor="Gray"
                            VerticalOptions="Fill"
                            TextChanged="_search_OnTextChanged"
                            BackgroundColor="{TemplateBinding TextBackgroundColor}"
                            TextColor="{TemplateBinding TextColor}"
                            Placeholder="{Binding PlaceHolder}"
                            Margin="0"
                            Keyboard="Plain" VerticalTextAlignment="Center"
                        />
                        
                    </Grid>
                
                </local:MobileCard>
            
            </Grid>
        </ControlTemplate>

        
    </ContentView.ControlTemplate>

</ContentView>