WheresMyMoney/WheresMyMoney.Maui/BalanceHistoryPage.xaml

69 lines
4.1 KiB
Plaintext
Raw Normal View History

2025-01-25 00:27:02 +01:00
<?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"
xmlns:local="clr-namespace:WheresMyMoney.Maui"
x:Class="WheresMyMoney.Maui.BalanceHistoryPage">
<CollectionView ItemsSource="{Binding GroupedBalanceChangeViewModels}"
RemainingItemsThreshold="5"
RemainingItemsThresholdReached="ItemsView_OnRemainingItemsThresholdReached">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="local:GroupedBalanceChangeViewModel">
<VerticalStackLayout>
<Grid Padding="10" ColumnSpacing="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Date Text -->
<Label Grid.Column="0"
Text="{Binding DateText}"
VerticalTextAlignment="Start" />
<!-- Balance Changes List -->
<VerticalStackLayout Grid.Column="1"
BindableLayout.ItemsSource="{Binding BalanceChanges}">
<BindableLayout.ItemTemplate>
<DataTemplate x:DataType="local:BalanceChangeViewModel">
<VerticalStackLayout>
<BoxView HeightRequest="1" BackgroundColor="Gray" Margin="0,5,0,5" />
<Label Text="{Binding Name}"
FontSize="20"
FontAttributes="None" />
<Label Text="{Binding AmountText}"
FontSize="20"
FontAttributes="Bold"
HorizontalTextAlignment="End">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsPayment}"
Value="False">
<Setter Property="TextColor" Value="Green" />
</DataTrigger>
<DataTrigger TargetType="Label" Binding="{Binding IsPayment}"
Value="True">
<Setter Property="TextColor" Value="Red" />
</DataTrigger>
</Label.Triggers>
</Label>
<Label Text="{Binding BalanceText}"
FontSize="20"
FontAttributes="Bold"
HorizontalTextAlignment="End">
<Label.Triggers>
<DataTrigger TargetType="Label" Binding="{Binding IsBalanceNegative}"
Value="True">
<Setter Property="TextColor" Value="Red" />
</DataTrigger>
</Label.Triggers>
</Label>
</VerticalStackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</Grid>
</VerticalStackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</ContentPage>