Add TodoApp sample with reconstructed XAML
Complete TodoApp sample application with: - App.xaml/cs: Colors and styles for light/dark themes - TodoListPage: Task list with theme toggle switch - NewTodoPage: Form to create new tasks - TodoDetailPage: Edit task details with delete option - TodoItem.cs/TodoService.cs: Data model and service - SVG icons for save, delete, and add actions Theme switching via toggle on main page applies app-wide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
83
samples/TodoApp/TodoListPage.xaml
Normal file
83
samples/TodoApp/TodoListPage.xaml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?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:TodoApp"
|
||||
x:Class="TodoApp.TodoListPage"
|
||||
Title="My Tasks"
|
||||
BackgroundColor="{AppThemeBinding Light={StaticResource PageBackgroundLight}, Dark={StaticResource PageBackgroundDark}}">
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Text="+" Clicked="OnAddClicked" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<Grid RowDefinitions="*,Auto">
|
||||
<!-- Task List -->
|
||||
<CollectionView x:Name="TodoCollectionView"
|
||||
Grid.Row="0"
|
||||
SelectionMode="None">
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate x:DataType="local:TodoItem">
|
||||
<Grid Padding="16,8">
|
||||
<Border BackgroundColor="{AppThemeBinding Light={StaticResource CardBackgroundLight}, Dark={StaticResource CardBackgroundDark}}"
|
||||
Stroke="{AppThemeBinding Light={StaticResource BorderLight}, Dark={StaticResource BorderDark}}"
|
||||
StrokeThickness="0"
|
||||
Padding="0">
|
||||
<Border.StrokeShape>
|
||||
<RoundRectangle CornerRadius="8" />
|
||||
</Border.StrokeShape>
|
||||
<Grid ColumnDefinitions="4,*">
|
||||
<!-- Accent Border -->
|
||||
<BoxView Grid.Column="0"
|
||||
Color="{StaticResource PrimaryColor}"
|
||||
WidthRequest="4" />
|
||||
|
||||
<!-- Content -->
|
||||
<VerticalStackLayout Grid.Column="1"
|
||||
Padding="16,12"
|
||||
Spacing="4">
|
||||
<Label Text="{Binding Title}"
|
||||
FontSize="16"
|
||||
FontAttributes="Bold"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextPrimaryLight}, Dark={StaticResource TextPrimaryDark}}" />
|
||||
<Label Text="{Binding Notes}"
|
||||
FontSize="14"
|
||||
MaxLines="2"
|
||||
LineBreakMode="TailTruncation"
|
||||
TextColor="{AppThemeBinding Light={StaticResource TextSecondaryLight}, Dark={StaticResource TextSecondaryDark}}" />
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
<Border.GestureRecognizers>
|
||||
<TapGestureRecognizer Tapped="OnItemTapped" CommandParameter="{Binding .}" />
|
||||
</Border.GestureRecognizers>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
|
||||
<!-- Footer -->
|
||||
<Grid Grid.Row="1"
|
||||
ColumnDefinitions="*,Auto,Auto"
|
||||
Padding="16,12"
|
||||
ColumnSpacing="16"
|
||||
BackgroundColor="{StaticResource PrimaryColor}">
|
||||
|
||||
<Label x:Name="StatsLabel"
|
||||
Grid.Column="0"
|
||||
Text="Tasks: 0 of 3"
|
||||
TextColor="White"
|
||||
FontSize="14"
|
||||
VerticalOptions="Center" />
|
||||
|
||||
<Label Grid.Column="1"
|
||||
Text="💡"
|
||||
FontSize="20"
|
||||
VerticalOptions="Center" />
|
||||
|
||||
<Switch x:Name="ThemeSwitch"
|
||||
Grid.Column="2"
|
||||
Toggled="OnThemeToggled"
|
||||
VerticalOptions="Center" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user