Files
maui-linux/samples/ShellDemo/Pages/HomePage.xaml.cs
Dave Friedel 01270c6938 Add ShellDemo sample with comprehensive XAML controls showcase
Complete ShellDemo application demonstrating all MAUI controls:
- App/AppShell: Shell navigation with flyout menu
- HomePage: Feature cards, theme toggle, quick actions
- ButtonsPage: Button styles, states, variations, event logging
- TextInputPage: Entry, Editor, SearchBar with keyboard shortcuts
- SelectionPage: CheckBox, Switch, Slider with colored variants
- PickersPage: Picker, DatePicker, TimePicker demos
- ListsPage: CollectionView with fruits, colors, contacts
- ProgressPage: ProgressBar, ActivityIndicator, interactive demo
- GridsPage: Grid layouts - auto/star/absolute sizing, spans, nesting
- AboutPage: OpenMaui Linux information
- DetailPage: Push/pop navigation demo

All pages use proper XAML with code-behind following MAUI patterns.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-01 20:02:24 -05:00

63 lines
1.6 KiB
C#

using System;
using Microsoft.Maui.ApplicationModel;
using Microsoft.Maui.Controls;
namespace ShellDemo.Pages;
public partial class HomePage : ContentPage
{
public HomePage()
{
InitializeComponent();
ThemeSwitch.IsToggled = Application.Current?.UserAppTheme == AppTheme.Dark;
}
private void OnThemeToggled(object? sender, ToggledEventArgs e)
{
if (Application.Current != null)
{
Application.Current.UserAppTheme = e.Value ? AppTheme.Dark : AppTheme.Light;
}
}
private async void OnButtonsCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//Buttons");
}
private async void OnTextInputCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//TextInput");
}
private async void OnSelectionCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//Selection");
}
private async void OnPickersCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//Pickers");
}
private async void OnListsCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//Lists");
}
private async void OnProgressCardTapped(object? sender, TappedEventArgs e)
{
await Shell.Current.GoToAsync("//Progress");
}
private async void OnTryButtonsClicked(object? sender, EventArgs e)
{
await Shell.Current.GoToAsync("//Buttons");
}
private async void OnTryListsClicked(object? sender, EventArgs e)
{
await Shell.Current.GoToAsync("//Lists");
}
}