From 279006633331429eacbae8523b8d23a542b84fa8 Mon Sep 17 00:00:00 2001 From: rabbitism Date: Sun, 3 Mar 2024 16:09:17 +0800 Subject: [PATCH] feat: implement command, fix icon foreground in light mode. --- demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml | 1 + .../Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs | 13 +++++++++++++ src/Ursa.Themes.Semi/Controls/Breadcrumb.axaml | 2 +- src/Ursa/Controls/Breadcrumb/BreadcrumbItem.cs | 6 ++++-- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml b/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml index 9ceef32..0e44740 100644 --- a/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml +++ b/demo/Ursa.Demo/Pages/BreadcrumbDemo.axaml @@ -26,6 +26,7 @@ diff --git a/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs b/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs index 1fd7535..babdf6d 100644 --- a/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs +++ b/demo/Ursa.Demo/ViewModels/BreadcrumbDemoViewModel.cs @@ -1,5 +1,8 @@ using System.Collections.ObjectModel; +using System.Windows.Input; using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; +using Ursa.Controls; namespace Ursa.Demo.ViewModels; @@ -24,4 +27,14 @@ public class BreadcrumbDemoItem: ObservableObject { public string Section { get; set; } public string Icon { get; set; } + + public ICommand Command { get; set; } + + public BreadcrumbDemoItem() + { + Command = new RelayCommand(() => + { + MessageBox.ShowOverlayAsync(Section); + }); + } } \ No newline at end of file diff --git a/src/Ursa.Themes.Semi/Controls/Breadcrumb.axaml b/src/Ursa.Themes.Semi/Controls/Breadcrumb.axaml index 7d9b206..554f5d5 100644 --- a/src/Ursa.Themes.Semi/Controls/Breadcrumb.axaml +++ b/src/Ursa.Themes.Semi/Controls/Breadcrumb.axaml @@ -33,7 +33,7 @@ VerticalAlignment="Center" Content="{TemplateBinding Icon}" ContentTemplate="{TemplateBinding IconTemplate}" - Foreground="{TemplateBinding Foreground}" + Foreground="{DynamicResource SemiColorText2}" IsVisible="{TemplateBinding Icon, Converter={x:Static ObjectConverters.IsNotNull}}" /> SetValue(IconTemplateProperty, value); } - static BreadcrumbItem() + protected override void OnPointerPressed(PointerPressedEventArgs e) { - + base.OnPointerPressed(e); + Command?.Execute(null); } } \ No newline at end of file