<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:conv="clr-namespace:Banquale.Views.Converters"
             x:Class="Banquale.Views.Balance.BalanceView">

    <ContentView.Resources>
        <conv:Bool2ColorConverters x:Key="bool2ColorConverters"/>
        <conv:Int2StringConverters x:Key="int2StringConverters"/>
    </ContentView.Resources>

    <VerticalStackLayout>



        <ListView ItemsSource="{Binding TransactionsList}"
                  SelectionMode="None">

            <ListView.ItemTemplate>

                <DataTemplate>

                    <ViewCell>

                        <Grid
                            ColumnDefinitions="40, 3*, *"
                            Margin="20, 5, 20, 5"
                            HorizontalOptions="Fill">

                            <Grid.GestureRecognizers>
                                <TapGestureRecognizer
                                    Tapped="Transaction_Clicked"
                                    NumberOfTapsRequired="1" />

                            </Grid.GestureRecognizers>

                            <Label
                                Text="{Binding Id}"
                                Grid.Column="0"
                                x:Name="transactionId"/>

                            <Label
                                Text="{Binding Date, StringFormat='{0:ddd dd MMM yyyy}'}"
                                Grid.Column="1"
                                VerticalOptions="Center"
                                Margin="10, 0, 0, 0"/>

                            <Label
                                Text="{Binding Sum, StringFormat='{0} €'}"
                                Grid.Column="2"
                                TextColor="{Binding Type, Converter={StaticResource bool2ColorConverters}}"
                                VerticalOptions="Center"
                                HorizontalOptions="End"
                                Margin="0, 0, 20, 0"/>
                                <!--Text="{Binding Sum, Converter={StaticResource int2StringConverters}, ConverterParameter={Binding Type}, StringFormat='{0} €'}"-->
                                

                        </Grid>

                    </ViewCell>

                </DataTemplate>

            </ListView.ItemTemplate>

        </ListView>

    </VerticalStackLayout>
</ContentView>

