diff --git a/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml b/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml index e5affdc..0636b90 100644 --- a/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml +++ b/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml @@ -23,6 +23,13 @@ Content="Gesture Enabled" IsChecked="True" IsCheckedChanged="OnGestureChanged" /> + + + + + + + @@ -35,38 +42,36 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml.cs b/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml.cs index 7e0316f..4428e53 100644 --- a/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml.cs +++ b/demo/Semi.Avalonia.Demo/Pages/DrawerPageDemo.axaml.cs @@ -1,8 +1,9 @@ using System; +using System.Linq; using Avalonia.Controls; +using Avalonia.Input.GestureRecognizers; using Avalonia.Interactivity; using Avalonia.Layout; -using Avalonia.Media; namespace Semi.Avalonia.Demo.Pages; @@ -11,6 +12,7 @@ public partial class DrawerPageDemo : UserControl public DrawerPageDemo() { InitializeComponent(); + EnableMouseSwipeGesture(DemoDrawer); } protected override void OnLoaded(RoutedEventArgs e) @@ -52,7 +54,6 @@ public partial class DrawerPageDemo : UserControl FontSize = 16, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, - Foreground = Brushes.Black, }, HorizontalContentAlignment = HorizontalAlignment.Stretch, VerticalContentAlignment = VerticalAlignment.Stretch @@ -65,4 +66,25 @@ public partial class DrawerPageDemo : UserControl { StatusText.Text = $"Drawer: {(DemoDrawer.IsOpen ? "Open" : "Closed")}"; } + + private static void EnableMouseSwipeGesture(Control control) + { + var recognizer = control.GestureRecognizers + .OfType() + .FirstOrDefault(); + + recognizer?.IsMouseEnabled = true; + } + + private void OnLayoutChanged(object? sender, SelectionChangedEventArgs e) + { + DemoDrawer.DrawerLayoutBehavior = (sender as ComboBox)?.SelectedIndex switch + { + 0 => DrawerLayoutBehavior.CompactOverlay, + 1 => DrawerLayoutBehavior.CompactInline, + 2 => DrawerLayoutBehavior.Split, + 3 => DrawerLayoutBehavior.Overlay, + _ => DrawerLayoutBehavior.CompactOverlay + }; + } } \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/DrawerPage.axaml b/src/Semi.Avalonia/Controls/DrawerPage.axaml index e56179b..556a7e2 100644 --- a/src/Semi.Avalonia/Controls/DrawerPage.axaml +++ b/src/Semi.Avalonia/Controls/DrawerPage.axaml @@ -1,6 +1,4 @@ - + @@ -8,142 +6,247 @@ - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - + Name="PART_CompactPaneToggle" + Width="{DynamicResource ButtonDefaultHeight}" + Height="{DynamicResource ButtonDefaultHeight}" + HorizontalAlignment="Left" + AutomationProperties.Name="Toggle navigation drawer" + Background="Transparent" + DockPanel.Dock="Top" + IsChecked="{Binding #PART_SplitView.IsPaneOpen, Mode=TwoWay}" + IsVisible="False" + ToolTip.Tip="Toggle navigation drawer"> + + - - - - - - + ContentTemplate="{TemplateBinding DrawerIconTemplate}" + Foreground="{DynamicResource DrawerPagePaneButtonForeground}" + IsVisible="{TemplateBinding DrawerIcon, Converter={x:Static ObjectConverters.IsNotNull}}" /> + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + - - - + CornerRadius="{TemplateBinding CornerRadius}" /> + - - - - - + + - - - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/src/Semi.Avalonia/Themes/Dark/DrawerPage.axaml b/src/Semi.Avalonia/Themes/Dark/DrawerPage.axaml index 09cd1a7..1a5dc4a 100644 --- a/src/Semi.Avalonia/Themes/Dark/DrawerPage.axaml +++ b/src/Semi.Avalonia/Themes/Dark/DrawerPage.axaml @@ -4,10 +4,6 @@ - - - - diff --git a/src/Semi.Avalonia/Themes/HighContrast/DrawerPage.axaml b/src/Semi.Avalonia/Themes/HighContrast/DrawerPage.axaml index aa185e9..e13eef0 100644 --- a/src/Semi.Avalonia/Themes/HighContrast/DrawerPage.axaml +++ b/src/Semi.Avalonia/Themes/HighContrast/DrawerPage.axaml @@ -4,10 +4,6 @@ - - - - diff --git a/src/Semi.Avalonia/Themes/Light/DrawerPage.axaml b/src/Semi.Avalonia/Themes/Light/DrawerPage.axaml index e2098ff..518a63f 100644 --- a/src/Semi.Avalonia/Themes/Light/DrawerPage.axaml +++ b/src/Semi.Avalonia/Themes/Light/DrawerPage.axaml @@ -4,10 +4,6 @@ - - - - \ No newline at end of file diff --git a/src/Semi.Avalonia/Themes/Shared/DrawerPage.axaml b/src/Semi.Avalonia/Themes/Shared/DrawerPage.axaml index 48c5d66..e637290 100644 --- a/src/Semi.Avalonia/Themes/Shared/DrawerPage.axaml +++ b/src/Semi.Avalonia/Themes/Shared/DrawerPage.axaml @@ -1,15 +1,7 @@ - 48 - 4 0 - 0 0 0 1 - - - 280 - 56 + 32 - 32 - 8 0