<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
    x:Class="FirstXamarinFormsApplication.Client.ListItemView"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    ControlTemplate="{StaticResource PageTemplate}"
    Title="List">
    <ContentPage.ToolbarItems>
        <ToolbarItem
            Name="Action"
            Command="{Binding ChangeTitleCommand}"
            Order="Primary"
            Priority="0"
            Text="Edit" />
        <ToolbarItem
            Name="Another"
            Order="Primary"
            Priority="1"
            Text="Delete" />
    </ContentPage.ToolbarItems>
    <NavigationPage.TitleView>
        <StackLayout
            Orientation="Horizontal"
            Spacing="10"
            VerticalOptions="Center">
            <Image Source="Xamarin.png" />
            <Label
                FontSize="16"
                Text="Custom Title View"
                TextColor="Black"
                VerticalTextAlignment="Center" />
        </StackLayout>
    </NavigationPage.TitleView>
    <ContentPage.Content>
        <AbsoluteLayout>
            <ListView
                ItemTapped="Handle_ItemTapped"
                ItemsSource="{Binding Items}"
                SeparatorVisibility="None">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="60" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Image
                                    Grid.RowSpan="2"
                                    Grid.Column="0"
                                    Margin="5,5"
                                    Source="{Binding Image}" />
                                <Label
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    Font="Small"
                                    Text="{Binding Title}"
                                    VerticalTextAlignment="End" />
                                <Label
                                    Grid.Row="1"
                                    Grid.Column="1"
                                    Text="{Binding Description}"
                                    VerticalTextAlignment="Start" />
                            </Grid>
                            <ViewCell.ContextActions>
                                <ToolbarItem Text="Edit" />
                                <ToolbarItem IsDestructive="true" Text="Delete" />
                            </ViewCell.ContextActions>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
            <Image
                Margin="10"
                AbsoluteLayout.LayoutBounds="1.0,1.0"
                AbsoluteLayout.LayoutFlags="PositionProportional"
                HeightRequest="60"
                Source="AddIcon.png"
                WidthRequest="60" />
        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>
