From 8ad659cba6973a2de0ed9d89b8a5856436f1083f Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 21 Dec 2022 17:12:11 +0800 Subject: [PATCH 1/3] feat: WIP: flyout default theme. pending on DynamicResource. --- src/Semi.Avalonia.Demo/MainWindow.axaml | 3 ++ src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml | 23 ++++++++++ .../Pages/FlyoutDemo.axaml.cs | 19 ++++++++ src/Semi.Avalonia.Demo/Program.cs | 2 +- src/Semi.Avalonia/Controls/Controls.axaml | 2 + .../Controls/FlyoutPresenter.axaml | 44 +++++++++++++++++++ src/Semi.Avalonia/Controls/Popup.axaml | 23 ++++++++++ src/Semi.Avalonia/Themes/LightTheme.axaml | 13 +++--- 8 files changed, 121 insertions(+), 8 deletions(-) create mode 100644 src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml create mode 100644 src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml.cs create mode 100644 src/Semi.Avalonia/Controls/FlyoutPresenter.axaml create mode 100644 src/Semi.Avalonia/Controls/Popup.axaml diff --git a/src/Semi.Avalonia.Demo/MainWindow.axaml b/src/Semi.Avalonia.Demo/MainWindow.axaml index 2b3c127..e5a4b98 100644 --- a/src/Semi.Avalonia.Demo/MainWindow.axaml +++ b/src/Semi.Avalonia.Demo/MainWindow.axaml @@ -44,5 +44,8 @@ + + + diff --git a/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml new file mode 100644 index 0000000..d888da6 --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml.cs b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml.cs new file mode 100644 index 0000000..cc81678 --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml.cs @@ -0,0 +1,19 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.LogicalTree; +using Avalonia.Markup.Xaml; + +namespace Semi.Avalonia.Demo.Pages; + +public partial class FlyoutDemo : UserControl +{ + public FlyoutDemo() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } +} \ No newline at end of file diff --git a/src/Semi.Avalonia.Demo/Program.cs b/src/Semi.Avalonia.Demo/Program.cs index 77b86bd..f1878c7 100644 --- a/src/Semi.Avalonia.Demo/Program.cs +++ b/src/Semi.Avalonia.Demo/Program.cs @@ -27,7 +27,7 @@ namespace Semi.Avalonia.Demo public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .With(new Win32PlatformOptions(){ UseCompositor = true}) + .With(new Win32PlatformOptions(){ UseCompositor = false}) .LogToTrace(); } } \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/Controls.axaml b/src/Semi.Avalonia/Controls/Controls.axaml index 512673b..15f6d62 100644 --- a/src/Semi.Avalonia/Controls/Controls.axaml +++ b/src/Semi.Avalonia/Controls/Controls.axaml @@ -5,9 +5,11 @@ + + diff --git a/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml new file mode 100644 index 0000000..3239e54 --- /dev/null +++ b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/Popup.axaml b/src/Semi.Avalonia/Controls/Popup.axaml new file mode 100644 index 0000000..c643e4a --- /dev/null +++ b/src/Semi.Avalonia/Controls/Popup.axaml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Themes/LightTheme.axaml b/src/Semi.Avalonia/Themes/LightTheme.axaml index 28c6a29..c6b6155 100644 --- a/src/Semi.Avalonia/Themes/LightTheme.axaml +++ b/src/Semi.Avalonia/Themes/LightTheme.axaml @@ -1,16 +1,15 @@ - - + + - - - + + + From 06ab6cd7d5e68199219e38d854b95431a5b48dd4 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Thu, 22 Dec 2022 01:36:14 +0800 Subject: [PATCH 2/3] feat: add flyout dynamic resource. Pending on Menu/MenuItem to add menu flyout theme. --- .../Controls/FlyoutPresenter.axaml | 20 +++++++++---------- src/Semi.Avalonia/Themes/Light/Flyout.axaml | 19 ++++++++++++++++++ src/Semi.Avalonia/Themes/Light/Light.axaml | 1 + 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 src/Semi.Avalonia/Themes/Light/Flyout.axaml diff --git a/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml index 3239e54..d8f0ff8 100644 --- a/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml +++ b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml @@ -3,18 +3,18 @@ - - - - - - - - + + + + + + + + - + @@ -23,7 +23,7 @@ Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" - BoxShadow="0 0 8 0 #1A000000" + BoxShadow="{DynamicResource FlyoutBorderBoxShadow}" ClipToBounds="False" CornerRadius="{TemplateBinding CornerRadius}" UseLayoutRounding="False"> diff --git a/src/Semi.Avalonia/Themes/Light/Flyout.axaml b/src/Semi.Avalonia/Themes/Light/Flyout.axaml new file mode 100644 index 0000000..d98d967 --- /dev/null +++ b/src/Semi.Avalonia/Themes/Light/Flyout.axaml @@ -0,0 +1,19 @@ + + + + 1 + 0 0 8 0 #1A000000 + 100 + 100 + 600 + 600 + 6 + 8 + + diff --git a/src/Semi.Avalonia/Themes/Light/Light.axaml b/src/Semi.Avalonia/Themes/Light/Light.axaml index 53c60ac..0a5a374 100644 --- a/src/Semi.Avalonia/Themes/Light/Light.axaml +++ b/src/Semi.Avalonia/Themes/Light/Light.axaml @@ -16,5 +16,6 @@ + From d3ca12854edcd2998c67f2d1a8ef5504b5c0b67a Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sat, 24 Dec 2022 14:59:42 +0800 Subject: [PATCH 3/3] feat: set flyout default font weight, add more demos. --- src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml | 116 ++++++++++++++++-- .../Controls/FlyoutPresenter.axaml | 4 +- src/Semi.Avalonia/Themes/Light/Flyout.axaml | 1 + 3 files changed, 107 insertions(+), 14 deletions(-) diff --git a/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml index d888da6..8c0e35e 100644 --- a/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml +++ b/src/Semi.Avalonia.Demo/Pages/FlyoutDemo.axaml @@ -7,17 +7,107 @@ d:DesignHeight="450" d:DesignWidth="800" mc:Ignorable="d"> - - - - - + + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml index d8f0ff8..651916d 100644 --- a/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml +++ b/src/Semi.Avalonia/Controls/FlyoutPresenter.axaml @@ -3,6 +3,7 @@ + @@ -35,7 +36,8 @@ HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Content="{TemplateBinding Content}" - ContentTemplate="{TemplateBinding ContentTemplate}" /> + ContentTemplate="{TemplateBinding ContentTemplate}" + FontWeight="{TemplateBinding FontWeight}" /> diff --git a/src/Semi.Avalonia/Themes/Light/Flyout.axaml b/src/Semi.Avalonia/Themes/Light/Flyout.axaml index d98d967..ca7579e 100644 --- a/src/Semi.Avalonia/Themes/Light/Flyout.axaml +++ b/src/Semi.Avalonia/Themes/Light/Flyout.axaml @@ -7,6 +7,7 @@ x:Key="FlyoutBorderBrush" Opacity="0.08" Color="#1C1F23" /> + 400 1 0 0 8 0 #1A000000 100