bank/MauiApp1/View/TransactionView.xaml
2022-07-01 13:10:10 +03:00

62 lines
No EOL
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MauiApp1.View.TransactionView"
Title="Transactions"
x:Name="TransactionPage">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Text="Добавить"
HorizontalOptions="Center"
VerticalOptions="Center"
Margin="20, 10"
Command="{Binding AddCommand}"/>
<CollectionView ItemsSource="{Binding Transactions}" Grid.Row="1" >
<CollectionView.ItemTemplate>
<DataTemplate>
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItemView Command="{Binding Path=BindingContext.EditCommand,
Source={x:Reference Name=TransactionPage}}" CommandParameter="{Binding .}">
<Frame BackgroundColor="LightGreen"
Margin="5">
<Label Text="✏️"
FontSize="Large"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
</Frame>
</SwipeItemView>
<SwipeItemView Command="{Binding Path=BindingContext.DeleteCommand,
Source={x:Reference Name=TransactionPage}}" CommandParameter="{Binding .}">
<Frame BackgroundColor="LightCoral" Margin="5">
<Label Text="🗑️"
FontSize="Large"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
</Frame>
</SwipeItemView>
</SwipeItems>
</SwipeView.RightItems>
<Frame CornerRadius="20" Margin="10" BackgroundColor="{AppThemeBinding Light={StaticResource FrameLight}, Dark={StaticResource FrameDark}}">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Category}" FontSize="Medium" HorizontalOptions="StartAndExpand"/>
<Label Text="{Binding Price}" FontSize="Medium"/>
</StackLayout>
<Label Text="{Binding Date}" FontSize="Micro"/>
</StackLayout>
</Frame>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
</ContentPage>