From d141831571f1bea96c0eaf6ec79555db5dcc503f Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 14 Feb 2024 21:45:50 +0800 Subject: [PATCH 1/2] feat: replace ursa demo with nav menu. --- .../Converters/IconNameToPathConverter.cs | 6 + demo/Ursa.Demo/Views/MainView.axaml | 113 +++++++++--------- src/Ursa.Themes.Semi/Controls/NavMenu.axaml | 56 ++++++--- 3 files changed, 104 insertions(+), 71 deletions(-) diff --git a/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs b/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs index 5a602e8..4451895 100644 --- a/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs +++ b/demo/Ursa.Demo/Converters/IconNameToPathConverter.cs @@ -26,6 +26,12 @@ public class IconNameToPathConverter: IValueConverter string s = paths[i % paths.Length]; return StreamGeometry.Parse(s); } + else if (value is string s) + { + int hash = s.GetHashCode(); + string path = paths[Math.Abs(hash) % paths.Length]; + return StreamGeometry.Parse(path); + } return AvaloniaProperty.UnsetValue; } diff --git a/demo/Ursa.Demo/Views/MainView.axaml b/demo/Ursa.Demo/Views/MainView.axaml index 956dbe4..664ef75 100644 --- a/demo/Ursa.Demo/Views/MainView.axaml +++ b/demo/Ursa.Demo/Views/MainView.axaml @@ -16,6 +16,9 @@ + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + @@ -33,9 +51,9 @@ Name="PART_Border" Grid.Row="0" MinHeight="32" - Cursor="Hand" Background="{TemplateBinding u:NavMenuItem.Background}" - CornerRadius="4"> + CornerRadius="4" + Cursor="Hand"> - + @@ -146,7 +164,7 @@ - + From ea447764059c6d9144f0c581a261a391d3dd0218 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Wed, 14 Feb 2024 21:52:50 +0800 Subject: [PATCH 2/2] feat: make tooltip utilize header template. --- src/Ursa.Themes.Semi/Controls/NavMenu.axaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml index c88c81c..d769a30 100644 --- a/src/Ursa.Themes.Semi/Controls/NavMenu.axaml +++ b/src/Ursa.Themes.Semi/Controls/NavMenu.axaml @@ -166,7 +166,11 @@