Skip to content

Commit

Permalink
Fix Wrong Setting AccentColor in ThemeResources
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Jan 29, 2021
1 parent e548ae5 commit cb9fc91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions src/Shared/HandyControl_Shared/ThemeManager/ThemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,13 @@ public static void SetAccentColor(DependencyObject d, Brush value)

public static readonly DependencyProperty AccentColorProperty =
DependencyProperty.RegisterAttached("AccentColor", typeof(Brush), typeof(ThemeManager),
new FrameworkPropertyMetadata(default,
OnAccentColorChanged));
new FrameworkPropertyMetadata(OnAccentColorChanged));

private static void OnAccentColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is FrameworkElement ctl)
{
ctl.Resources["PrimaryBrush"] = e.NewValue;
ctl.Resources["TitleColor"] = e.NewValue;
ctl.Resources["SecondaryTitleColor"] = e.NewValue;
}
}

Expand Down Expand Up @@ -277,8 +274,6 @@ private static void OnActualAccentColorChanged(DependencyObject d, DependencyPro
private void applyAccentColor(object Value)
{
Application.Current.Resources["PrimaryBrush"] = Value;
Application.Current.Resources["TitleColor"] = Value;
Application.Current.Resources["SecondaryTitleColor"] = Value;
}

#endregion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Brush AccentColor
if (HandyControl.Tools.ThemeManager.Current.ActualAccentColor != value)
{
HandyControl.Tools.ThemeManager.Current.SetCurrentValue(
HandyControl.Tools.ThemeManager.AccentColorProperty, value);
HandyControl.Tools.ThemeManager.ActualAccentColorProperty, value);

if (DesignMode.DesignModeEnabled)
{
Expand Down

0 comments on commit cb9fc91

Please sign in to comment.