From 89e8c2c5a378507069ce232322cbe0e6d8af9592 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Tue, 13 Feb 2024 17:47:54 +0800 Subject: [PATCH] feat: default styling. --- demo/Ursa.Demo/Pages/NavMenuDemo.axaml | 13 +++- .../ViewModels/NavMenuDemoViewModel.cs | 1 - src/Ursa.Themes.Semi/Controls/NavMenu.axaml | 73 ++++++++++++------- .../Converters/NavMenuMarginConverter.cs | 2 +- 4 files changed, 61 insertions(+), 28 deletions(-) diff --git a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml index bf1a6f8..59ade47 100644 --- a/demo/Ursa.Demo/Pages/NavMenuDemo.axaml +++ b/demo/Ursa.Demo/Pages/NavMenuDemo.axaml @@ -54,9 +54,20 @@ HeaderBinding="{Binding Header}" SubMenuBinding="{Binding Children}" IconBinding="{Binding}"> + + + + - + + diff --git a/demo/Ursa.Demo/ViewModels/NavMenuDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/NavMenuDemoViewModel.cs index f7dc981..7748926 100644 --- a/demo/Ursa.Demo/ViewModels/NavMenuDemoViewModel.cs +++ b/demo/Ursa.Demo/ViewModels/NavMenuDemoViewModel.cs @@ -4,7 +4,6 @@ using System.Windows.Input; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Ursa.Controls; - namespace Ursa.Demo.ViewModels; public class NavMenuDemoViewModel: ObservableObject diff --git a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml index 3b2e7ca..8236e96 100644 --- a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml +++ b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml @@ -9,7 +9,7 @@ - + @@ -22,8 +22,9 @@ @@ -81,8 +82,11 @@ - + - @@ -132,46 +137,64 @@ Width="8" Height="8" Margin="12,0" + RenderTransform="rotate(-90deg)" Data="{DynamicResource NavigationMenuItemExpandIconGlyph}" Foreground="{DynamicResource NavigationMenuItemExpandIconForeground}"> - - - - - - + - - - - - - + + + + + + + + diff --git a/src/Ursa.Themes.Semi/Converters/NavMenuMarginConverter.cs b/src/Ursa.Themes.Semi/Converters/NavMenuMarginConverter.cs index 999c0b1..6bd2c37 100644 --- a/src/Ursa.Themes.Semi/Converters/NavMenuMarginConverter.cs +++ b/src/Ursa.Themes.Semi/Converters/NavMenuMarginConverter.cs @@ -10,7 +10,7 @@ public class NavMenuMarginConverter: IMultiValueConverter { if (values[0] is double indent && values[1] is int level) { - return new Thickness(indent * level, 0, 0, 0); + return new Thickness(indent * (level-1), 0, 0, 0); } return AvaloniaProperty.UnsetValue; }