From 40bb60164ede75246e9b1d34da2e538d8560cc63 Mon Sep 17 00:00:00 2001 From: NaBian <836904362@qq.com> Date: Wed, 17 Jul 2024 22:56:54 +0800 Subject: [PATCH] chore: add avalonia button and brush demo. --- .../HandyControlDemo_Avalonia/App.axaml.cs | 6 +- .../Data/DemoInfo.json | 2 +- .../HandyControlDemo_Avalonia.csproj | 4 + .../UserControl/Main/LeftMainContent.axaml | 93 +++-- .../UserControl/Styles/BrushDemoCtl.axaml | 117 ++++++ .../UserControl/Styles/BrushDemoCtl.axaml.cs | 9 + .../UserControl/Styles/ButtonDemoCtl.axaml | 83 +++- .../ViewModel/Main/MainViewModel.cs | 4 +- .../Controls/Panel/UniformSpacingPanel.cs | 373 ++++++++++++++++++ .../Data/Enum/VisualWrapping.cs | 7 + .../HandyControl_Avalonia/Data/PanelUvSize.cs | 69 ++++ .../HandyControl_Avalonia.csproj | 5 +- .../Themes/Styles/Button.axaml | 177 ++++----- .../Themes/Styles/Label.axaml | 94 +++++ .../Themes/Styles/ListBox.axaml | 2 + .../Themes/Styles/ListBoxItem.axaml | 26 +- .../Themes/Styles/Style.axaml | 1 + .../Themes/Styles/TabControl.axaml | 62 +-- .../Themes/Styles/TabItem.axaml | 55 +-- .../Themes/Styles/Window.axaml | 2 +- .../Tools/Helper/MathHelper.cs | 16 + .../HandyControl_Net_40/Themes/Theme.xaml | 4 +- .../Controls/Panel/UniformSpacingPanel.cs | 104 +++-- 23 files changed, 1021 insertions(+), 294 deletions(-) create mode 100644 src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/BrushDemoCtl.axaml create mode 100644 src/Avalonia/HandyControlDemo_Avalonia/UserControl/Styles/BrushDemoCtl.axaml.cs create mode 100644 src/Avalonia/HandyControl_Avalonia/Controls/Panel/UniformSpacingPanel.cs create mode 100644 src/Avalonia/HandyControl_Avalonia/Data/Enum/VisualWrapping.cs create mode 100644 src/Avalonia/HandyControl_Avalonia/Data/PanelUvSize.cs create mode 100644 src/Avalonia/HandyControl_Avalonia/Themes/Styles/Label.axaml create mode 100644 src/Avalonia/HandyControl_Avalonia/Tools/Helper/MathHelper.cs diff --git a/src/Avalonia/HandyControlDemo_Avalonia/App.axaml.cs b/src/Avalonia/HandyControlDemo_Avalonia/App.axaml.cs index 1bb6fd369..74902c4b9 100644 --- a/src/Avalonia/HandyControlDemo_Avalonia/App.axaml.cs +++ b/src/Avalonia/HandyControlDemo_Avalonia/App.axaml.cs @@ -1,4 +1,5 @@ -using Avalonia; +using System.Globalization; +using Avalonia; using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Data.Core.Plugins; using Avalonia.Markup.Xaml; @@ -6,7 +7,7 @@ namespace HandyControlDemo; -public partial class App : Application +public class App : Application { public override void Initialize() { @@ -15,6 +16,7 @@ public override void Initialize() public override void OnFrameworkInitializationCompleted() { + Properties.Langs.Lang.Culture = new CultureInfo("en"); BindingPlugins.DataValidators.RemoveAt(0); if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) diff --git a/src/Avalonia/HandyControlDemo_Avalonia/Data/DemoInfo.json b/src/Avalonia/HandyControlDemo_Avalonia/Data/DemoInfo.json index b2f688de9..75d68c351 100644 --- a/src/Avalonia/HandyControlDemo_Avalonia/Data/DemoInfo.json +++ b/src/Avalonia/HandyControlDemo_Avalonia/Data/DemoInfo.json @@ -1,7 +1,7 @@ [ { "title": "Styles", - "selectedIndex": 0, + "selectedIndex": -1, "group": false, "demoItemList": [ [ "Brush", "BrushDemoCtl", "Brush.Brush", "", "" ], diff --git a/src/Avalonia/HandyControlDemo_Avalonia/HandyControlDemo_Avalonia.csproj b/src/Avalonia/HandyControlDemo_Avalonia/HandyControlDemo_Avalonia.csproj index 53ad41f1b..eeae15a11 100644 --- a/src/Avalonia/HandyControlDemo_Avalonia/HandyControlDemo_Avalonia.csproj +++ b/src/Avalonia/HandyControlDemo_Avalonia/HandyControlDemo_Avalonia.csproj @@ -57,6 +57,10 @@ ButtonDemoCtrl.axaml + + BoderDemoCtl.axaml + Code + diff --git a/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Main/LeftMainContent.axaml b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Main/LeftMainContent.axaml index 67246a934..7bbdd25a4 100644 --- a/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Main/LeftMainContent.axaml +++ b/src/Avalonia/HandyControlDemo_Avalonia/UserControl/Main/LeftMainContent.axaml @@ -6,46 +6,55 @@ Margin="16,16,0,16" CornerRadius="10" Effect="{StaticResource EffectShadow4}"> - - - - - - - - - - - - - - - - - - - - - - - - + +