zhaw-dnet2/Tasks/Lab12/TodoDetails/MainPage.xaml

68 lines
3.3 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"
xmlns:model="clr-namespace:TodoDetails.Model"
xmlns:viewmodel="clr-namespace:TodoDetails.ViewModel"
x:DataType="viewmodel:TodosViewModel"
x:Class="TodoDetails.MainPage"
Title="{Binding Title}">
<Grid ColumnSpacing="5"
RowSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<CollectionView ItemsSource="{Binding Todos}"
SelectionMode="None"
Grid.ColumnSpan="2">
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="model:Todo">
<Grid Padding="10">
<Border HeightRequest="125">
<Border.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodel:TodosViewModel}}, Path=GoToDetailsCommand}"
CommandParameter="{Binding .}"/>
</Border.GestureRecognizers>
<Grid Padding="0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<CheckBox IsChecked="{Binding IsDone}"/>
<VerticalStackLayout Grid.Column="1"
VerticalOptions="Center"
Padding="10">
<Label Text="{Binding Title}"
FontSize="16"/>
<Label Text="{Binding Category}"
FontSize="12"/>
</VerticalStackLayout>
<Label Text="{Binding DueDate}"
Grid.Column="2"
VerticalOptions="Center"/>
</Grid>
</Border>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Button Text="Fetch Todos"
Command="{Binding GetTodosCommand}"
IsEnabled="{Binding IsNotBusy}"
Grid.Row="1"
Margin="8"/>
<ActivityIndicator IsVisible="{Binding IsBusy}"
IsRunning="{Binding IsBusy}"
HorizontalOptions="Fill"
VerticalOptions="Center"
Color="{DynamicResource Primary}"
Grid.RowSpan="2"
Grid.ColumnSpan="2"/>
</Grid>
</ContentPage>