Skip to content

Commit f4d82f5

Browse files
Fix: Tag icons may use the wrong color
1 parent 2aab17e commit f4d82f5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/Files.App.Controls/ThemedIcon/ThemedIcon.Properties.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ protected virtual void OnOutlineIconPropertyChanged(string oldValue, string newV
3232
protected virtual void OnColorPropertyChanged(Brush oldValue, Brush newValue)
3333
{
3434
OnIconTypeChanged();
35+
UpdateColor(newValue);
3536
}
3637

3738
protected virtual void OnIconTypePropertyChanged(ThemedIconTypes oldValue, ThemedIconTypes newValue)

src/Files.App.Controls/ThemedIcon/ThemedIcon.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,14 @@ private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArg
240240
{
241241
UpdateVisualStates();
242242
}
243+
244+
private void UpdateColor(Brush newColor)
245+
{
246+
if (GetTemplateChild(OutlineIconPath) is Path outlinePath)
247+
outlinePath.Fill = newColor;
248+
249+
if (GetTemplateChild(FilledIconPath) is Path fillPath)
250+
fillPath.Fill = newColor;
251+
}
243252
}
244253
}

src/Files.App.Controls/ThemedIcon/ThemedIcon.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@
150150
</VisualState>
151151
<VisualState x:Name="Custom">
152152
<VisualState.Setters>
153-
<Setter Target="PART_OutlinePath.Fill" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Color}" />
154-
<Setter Target="PART_FilledPath.Fill" Value="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Color}" />
153+
<Setter Target="PART_OutlinePath.Fill" Value="{Binding Color, Mode=OneTime}" />
154+
<Setter Target="PART_FilledPath.Fill" Value="{Binding Color, Mode=OneTime}" />
155155
</VisualState.Setters>
156156
</VisualState>
157157
<VisualState x:Name="Toggle">

0 commit comments

Comments
 (0)