From 94b30bdb29d4c2cd617c253889b1573e50d28d53 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sun, 6 Nov 2022 00:41:32 +0800 Subject: [PATCH] feat: add button related resources. --- src/Semi.Avalonia.Demo/App.axaml | 9 +--- src/Semi.Avalonia.Demo/MainWindow.axaml | 6 +-- src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml | 14 +++++ .../Pages/ButtonDemo.axaml.cs | 18 +++++++ src/Semi.Avalonia/Controls/Button.axaml | 54 ++++++++++++------- src/Semi.Avalonia/Controls/Window.axaml | 6 +-- src/Semi.Avalonia/README.MD | 26 +++++++++ src/Semi.Avalonia/Themes/Dark/Button.axaml | 2 + src/Semi.Avalonia/Themes/Dark/Window.axaml | 4 +- src/Semi.Avalonia/Themes/DarkTheme.axaml | 21 +++++--- src/Semi.Avalonia/Themes/Light/Button.axaml | 25 ++++++++- src/Semi.Avalonia/Themes/Light/Window.axaml | 4 +- src/Semi.Avalonia/Themes/LightTheme.axaml | 22 +++++--- 13 files changed, 157 insertions(+), 54 deletions(-) create mode 100644 src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml create mode 100644 src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml.cs create mode 100644 src/Semi.Avalonia/README.MD diff --git a/src/Semi.Avalonia.Demo/App.axaml b/src/Semi.Avalonia.Demo/App.axaml index dee4770..3946d7d 100644 --- a/src/Semi.Avalonia.Demo/App.axaml +++ b/src/Semi.Avalonia.Demo/App.axaml @@ -2,13 +2,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Semi.Avalonia.Demo.App"> - + - - - - - - - diff --git a/src/Semi.Avalonia.Demo/MainWindow.axaml b/src/Semi.Avalonia.Demo/MainWindow.axaml index 3ff4055..7093382 100644 --- a/src/Semi.Avalonia.Demo/MainWindow.axaml +++ b/src/Semi.Avalonia.Demo/MainWindow.axaml @@ -2,11 +2,9 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:pages="using:Semi.Avalonia.Demo.Pages" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Semi.Avalonia.Demo.MainWindow" Title="Semi.Demo"> - - - - + diff --git a/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml b/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml new file mode 100644 index 0000000..6bb0593 --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml.cs b/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml.cs new file mode 100644 index 0000000..8d412cd --- /dev/null +++ b/src/Semi.Avalonia.Demo/Pages/ButtonDemo.axaml.cs @@ -0,0 +1,18 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace Semi.Avalonia.Demo.Pages; + +public partial class ButtonDemo : UserControl +{ + public ButtonDemo() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } +} \ No newline at end of file diff --git a/src/Semi.Avalonia/Controls/Button.axaml b/src/Semi.Avalonia/Controls/Button.axaml index eb980c3..d2876fc 100644 --- a/src/Semi.Avalonia/Controls/Button.axaml +++ b/src/Semi.Avalonia/Controls/Button.axaml @@ -1,16 +1,21 @@ - + + + - - - - + + + + - + - - + + + + + @@ -34,19 +39,32 @@ - - - + + + + + + diff --git a/src/Semi.Avalonia/Controls/Window.axaml b/src/Semi.Avalonia/Controls/Window.axaml index 2a75660..2ba614f 100644 --- a/src/Semi.Avalonia/Controls/Window.axaml +++ b/src/Semi.Avalonia/Controls/Window.axaml @@ -1,9 +1,9 @@ - - - + + + diff --git a/src/Semi.Avalonia/README.MD b/src/Semi.Avalonia/README.MD new file mode 100644 index 0000000..3acff27 --- /dev/null +++ b/src/Semi.Avalonia/README.MD @@ -0,0 +1,26 @@ +# Semi.Avalonia Theme + +## Naming Conventions + +Resources are named by following format + +`Control`+`Theme`[+`Class`+`PseudoClass`]+`Property` + +Example: + +`ButtonDefaultBackground` + +`ButtonSolidPointeroverBorderThickness` + +### Theme + +If Theme key is type default, use `Default` as Theme part + +### Class and PseudoClass + +* Classes comes before PseudoClasses + +* If multiple Classes are applied, order by alphabet order. + +* If multiple PseudoClass are applied, order by alphabet order. + diff --git a/src/Semi.Avalonia/Themes/Dark/Button.axaml b/src/Semi.Avalonia/Themes/Dark/Button.axaml index 779852d..0b8abd6 100644 --- a/src/Semi.Avalonia/Themes/Dark/Button.axaml +++ b/src/Semi.Avalonia/Themes/Dark/Button.axaml @@ -1,4 +1,6 @@ + + diff --git a/src/Semi.Avalonia/Themes/Dark/Window.axaml b/src/Semi.Avalonia/Themes/Dark/Window.axaml index 4331a5d..878105d 100644 --- a/src/Semi.Avalonia/Themes/Dark/Window.axaml +++ b/src/Semi.Avalonia/Themes/Dark/Window.axaml @@ -1,6 +1,6 @@ - - + + diff --git a/src/Semi.Avalonia/Themes/DarkTheme.axaml b/src/Semi.Avalonia/Themes/DarkTheme.axaml index bd31c4c..b18c9c7 100644 --- a/src/Semi.Avalonia/Themes/DarkTheme.axaml +++ b/src/Semi.Avalonia/Themes/DarkTheme.axaml @@ -1,9 +1,16 @@ - - - - - - - + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Themes/Light/Button.axaml b/src/Semi.Avalonia/Themes/Light/Button.axaml index 779852d..020d5f7 100644 --- a/src/Semi.Avalonia/Themes/Light/Button.axaml +++ b/src/Semi.Avalonia/Themes/Light/Button.axaml @@ -1,4 +1,25 @@ - + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=System.Runtime"> + + 14 + 600 + + 12 6 + 16 10 + 6 2 + + + + + + + + + + + + + + diff --git a/src/Semi.Avalonia/Themes/Light/Window.axaml b/src/Semi.Avalonia/Themes/Light/Window.axaml index d7d2825..53a8b3c 100644 --- a/src/Semi.Avalonia/Themes/Light/Window.axaml +++ b/src/Semi.Avalonia/Themes/Light/Window.axaml @@ -1,6 +1,6 @@ - - + + diff --git a/src/Semi.Avalonia/Themes/LightTheme.axaml b/src/Semi.Avalonia/Themes/LightTheme.axaml index b9f5b41..28c6a29 100644 --- a/src/Semi.Avalonia/Themes/LightTheme.axaml +++ b/src/Semi.Avalonia/Themes/LightTheme.axaml @@ -1,10 +1,16 @@ - - - - - - - - + + + + + + + + + + +