mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-30 21:23:23 +08:00
* feat: enhance navigation and UI structure in MainView and Application. * fix: using ContentPreseter and add HeaderTemplate. * feat: add locale resource for navigation drawer toggle button text. * feat: add customizations for DrawerPageDemo. * fix: fix DrawerPage title vertical alignment to Center. * Update DrawerPageDemo.axaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update DrawerPageDemo.axaml.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: fix bottom bar styles. * fix: update border background color in DrawerPageDemo.axaml. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
using System.Linq;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Input.GestureRecognizers;
|
|
using Avalonia.Layout;
|
|
|
|
namespace Semi.Avalonia.Demo.Pages;
|
|
|
|
public partial class DrawerPageDemo : UserControl
|
|
{
|
|
public DrawerPageDemo()
|
|
{
|
|
InitializeComponent();
|
|
EnableMouseSwipeGesture(DemoDrawer);
|
|
}
|
|
|
|
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,
|
|
},
|
|
HorizontalContentAlignment = HorizontalAlignment.Stretch,
|
|
VerticalContentAlignment = VerticalAlignment.Stretch
|
|
};
|
|
DemoDrawer.IsOpen = false;
|
|
}
|
|
}
|
|
|
|
private static void EnableMouseSwipeGesture(Control control)
|
|
{
|
|
var recognizer = control.GestureRecognizers
|
|
.OfType<SwipeGestureRecognizer>()
|
|
.FirstOrDefault();
|
|
|
|
recognizer?.IsMouseEnabled = true;
|
|
}
|
|
}
|