mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-08 10:16:35 +08:00
* Initial plan * Implement Semi Design theme for ContentPage, DrawerPage, NavigationPage, TabbedPage Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com> * fix: bind ItemsSource to Pages in TabControl of TabbedPage. * chore: split demo navigation pages. * demo: improve NavigationPage demo pages with interactive controls Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com> * fix: use comma-separated Padding syntax and remove trailing newline Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com> * feat: implement semi design theme for navigation controls in demo pages. * feat: enhance demo pages with foreground color for better visibility * feat: add back button visibility control and improve navigation page layout. * chore: remove DrawerPage unused static resources. * feat: add HighContrast resources for ContentPage, DrawerPage, NavigationPage, TabbedPage Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com> * feat: implement CardTabbedPage & ButtonTabbedPage themes. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: zdpcdt <54255897+zdpcdt@users.noreply.github.com> Co-authored-by: Dong Bin <popmessiah@hotmail.com>
68 lines
2.0 KiB
C#
68 lines
2.0 KiB
C#
using System;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Layout;
|
|
using Avalonia.Media;
|
|
|
|
namespace Semi.Avalonia.Demo.Pages;
|
|
|
|
public partial class DrawerPageDemo : UserControl
|
|
{
|
|
public DrawerPageDemo()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnLoaded(RoutedEventArgs e)
|
|
{
|
|
base.OnLoaded(e);
|
|
DemoDrawer.Opened += OnDrawerStatusChanged;
|
|
DemoDrawer.Closed += OnDrawerStatusChanged;
|
|
}
|
|
|
|
protected override void OnUnloaded(RoutedEventArgs e)
|
|
{
|
|
base.OnUnloaded(e);
|
|
DemoDrawer.Opened -= OnDrawerStatusChanged;
|
|
DemoDrawer.Closed -= OnDrawerStatusChanged;
|
|
}
|
|
|
|
private void OnDrawerStatusChanged(object? sender, EventArgs e) => UpdateStatus();
|
|
|
|
private void OnToggleDrawer(object? sender, RoutedEventArgs e)
|
|
{
|
|
DemoDrawer.IsOpen = !DemoDrawer.IsOpen;
|
|
}
|
|
|
|
private void OnGestureChanged(object? sender, RoutedEventArgs e)
|
|
{
|
|
DemoDrawer.IsGestureEnabled = GestureCheck.IsChecked == true;
|
|
}
|
|
|
|
private void OnMenuSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
|
{
|
|
if (DrawerMenu.SelectedItem is ListBoxItem item)
|
|
{
|
|
DemoDrawer.Content = new ContentPage
|
|
{
|
|
Header = item.Content?.ToString(),
|
|
Content = new TextBlock
|
|
{
|
|
Text = $"{item.Content} page content",
|
|
FontSize = 16,
|
|
HorizontalAlignment = HorizontalAlignment.Center,
|
|
VerticalAlignment = VerticalAlignment.Center,
|
|
Foreground = Brushes.Black,
|
|
},
|
|
HorizontalContentAlignment = HorizontalAlignment.Stretch,
|
|
VerticalContentAlignment = VerticalAlignment.Stretch
|
|
};
|
|
DemoDrawer.IsOpen = false;
|
|
}
|
|
}
|
|
|
|
private void UpdateStatus()
|
|
{
|
|
StatusText.Text = $"Drawer: {(DemoDrawer.IsOpen ? "Open" : "Closed")}";
|
|
}
|
|
} |