Preview 3: Complete control implementation with XAML data binding

Major milestone adding full control functionality:

Controls Enhanced:
- Entry/Editor: Full keyboard input, cursor navigation, selection, clipboard
- CollectionView: Data binding, selection highlighting, scrolling
- CheckBox/Switch/Slider: Interactive state management
- Picker/DatePicker/TimePicker: Dropdown selection with popup overlays
- ProgressBar/ActivityIndicator: Animated progress display
- Button: Press/release visual states
- Border/Frame: Rounded corners, stroke styling
- Label: Text wrapping, alignment, decorations
- Grid/StackLayout: Margin and padding support

Features Added:
- DisplayAlert dialogs with button actions
- NavigationPage with toolbar and back navigation
- Shell with flyout menu navigation
- XAML value converters for data binding
- Margin support in all layout containers
- Popup overlay system for pickers

New Samples:
- TodoApp: Full CRUD task manager with NavigationPage
- ShellDemo: Comprehensive control showcase

Removed:
- ControlGallery (replaced by ShellDemo)
- LinuxDemo (replaced by TodoApp)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
logikonline
2025-12-21 13:26:56 -05:00
parent f945d2a537
commit 1d55ac672a
142 changed files with 38925 additions and 4201 deletions

View File

@@ -0,0 +1,91 @@
// TodoDetailPage - View and edit a todo item
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Platform;
namespace TodoApp;
public partial class TodoDetailPage : ContentPage
{
private readonly TodoItem _todo;
private readonly TodoService _service = TodoService.Instance;
// Colors for status label
private static readonly Color AccentColor = Color.FromArgb("#26A69A");
private static readonly Color TextPrimary = Color.FromArgb("#212121");
public TodoDetailPage(TodoItem todo)
{
try
{
Console.WriteLine($"[TodoDetailPage] Constructor starting for: {todo.Title}");
InitializeComponent();
Console.WriteLine($"[TodoDetailPage] InitializeComponent complete");
_todo = todo;
// Populate fields
Console.WriteLine($"[TodoDetailPage] Setting TitleEntry.Text");
TitleEntry.Text = _todo.Title;
Console.WriteLine($"[TodoDetailPage] Setting NotesEditor.Text");
NotesEditor.Text = _todo.Notes;
Console.WriteLine($"[TodoDetailPage] Setting CompletedCheckBox.IsChecked");
CompletedCheckBox.IsChecked = _todo.IsCompleted;
Console.WriteLine($"[TodoDetailPage] Calling UpdateStatusLabel");
UpdateStatusLabel(_todo.IsCompleted);
Console.WriteLine($"[TodoDetailPage] Setting CreatedLabel.Text");
CreatedLabel.Text = $"Created {_todo.CreatedAt:MMMM d, yyyy} at {_todo.CreatedAt:h:mm tt}";
Console.WriteLine($"[TodoDetailPage] Constructor complete");
}
catch (Exception ex)
{
Console.WriteLine($"[TodoDetailPage] EXCEPTION in constructor: {ex.GetType().Name}: {ex.Message}");
Console.WriteLine($"[TodoDetailPage] Stack trace: {ex.StackTrace}");
throw;
}
}
private void OnCompletedChanged(object? sender, Microsoft.Maui.Controls.CheckedChangedEventArgs e)
{
Console.WriteLine($"[TodoDetailPage] OnCompletedChanged: {e.Value}");
UpdateStatusLabel(e.Value);
}
private void UpdateStatusLabel(bool isCompleted)
{
if (StatusLabel == null)
{
Console.WriteLine($"[TodoDetailPage] UpdateStatusLabel: StatusLabel is null, skipping");
return;
}
Console.WriteLine($"[TodoDetailPage] UpdateStatusLabel: setting to {(isCompleted ? "Completed" : "In Progress")}");
StatusLabel.Text = isCompleted ? "Completed" : "In Progress";
StatusLabel.TextColor = isCompleted ? AccentColor : TextPrimary;
}
private async void OnSaveClicked(object? sender, EventArgs e)
{
_todo.Title = TitleEntry.Text ?? "";
_todo.Notes = NotesEditor.Text ?? "";
_todo.IsCompleted = CompletedCheckBox.IsChecked;
await Navigation.PopAsync();
}
private async void OnDeleteClicked(object? sender, EventArgs e)
{
// Show confirmation dialog
var confirmed = await LinuxDialogService.ShowAlertAsync(
"Delete Task",
$"Are you sure you want to delete \"{_todo.Title}\"? This action cannot be undone.",
"Delete",
"Cancel");
if (confirmed)
{
_service.DeleteTodo(_todo);
await Navigation.PopAsync();
}
}
}