<?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"
             xmlns:local="clr-namespace:inutralia"
             x:Class="inutralia.Views.Question.NewConsultationView"
             x:Name="newConsultationView"
             Title="Nueva Consulta"
             Icon="Add1"           
             NavigationPage.HasBackButton="True">

    <ContentPage.Resources>
        <ResourceDictionary>
            <local:SelectorDataTemplate x:Key="MessageTemplateSelector"/>
        </ResourceDictionary>
    </ContentPage.Resources>

    <ContentPage.Content>
        <Grid RowSpacing="0" ColumnSpacing="0" Padding="0,10,0,0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ScrollView >
                <ListView x:Name="MessagesListView" 
                          ItemTemplate="{StaticResource MessageTemplateSelector}" 
                          ItemsSource="{Binding ListMessages}" 
                          ItemTapped="ItemTapped"
                         
                          BackgroundColor="White"
                          HasUnevenRows="True" 
                          SeparatorVisibility="None"
                          CachingStrategy="RecycleElement"
                          Footer=""/>
            </ScrollView>

            <StackLayout Orientation="Horizontal" Grid.Row="1" BackgroundColor="White" Padding="10,0,10,10" HeightRequest="40">
                <Entry HorizontalOptions="FillAndExpand"  
                       Placeholder="  Escriba aquí su mensaje"  
                       Text="{Binding OutText}"                                             
                       HeightRequest="10"/>

                <Image Source="btn_enviar_chat.png" WidthRequest="40" VerticalOptions="FillAndExpand" BackgroundColor="#FFA2C300" Aspect="AspectFit">
                    <Image.GestureRecognizers>
                        <TapGestureRecognizer
                                Command="{Binding SendCommand}" />
                    </Image.GestureRecognizers>
                </Image>
            </StackLayout>
        </Grid>
    </ContentPage.Content>
</ContentPage>