From 6089e6f4c484fdbdbb33184c311d1947e30d34f8 Mon Sep 17 00:00:00 2001 From: Filippo Ferrario <102259289+ferrariofilippo@users.noreply.github.com> Date: Tue, 17 Dec 2024 22:02:15 +0100 Subject: [PATCH] Fix: Fixed an issue where tags would sometimes display with the wrong color (#16603) --- .../ThemedIcon/ThemedIcon.Properties.cs | 1 + src/Files.App.Controls/ThemedIcon/ThemedIcon.cs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs index a6c1d8ecc5c5..6a24e2b4e15b 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs @@ -32,6 +32,7 @@ protected virtual void OnOutlineIconPropertyChanged(string oldValue, string newV protected virtual void OnColorPropertyChanged(Brush oldValue, Brush newValue) { OnIconTypeChanged(); + OnIconColorChanged(); } protected virtual void OnIconTypePropertyChanged(ThemedIconTypes oldValue, ThemedIconTypes newValue) diff --git a/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs b/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs index 57a14dc3d81f..7b1ee43e438c 100644 --- a/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs +++ b/src/Files.App.Controls/ThemedIcon/ThemedIcon.cs @@ -240,5 +240,14 @@ private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArg { UpdateVisualStates(); } + + private void OnIconColorChanged() + { + if (GetTemplateChild(OutlineIconPath) is Path outlinePath) + outlinePath.Fill = (Brush)this.GetValue(ColorProperty); + + if (GetTemplateChild(FilledIconPath) is Path fillPath) + fillPath.Fill = (Brush)this.GetValue(ColorProperty); + } } }