Example #1
0
 public static void UpdateBrushes(ResourceDictionary themeDictionary, ResourceDictionary colors)
 {
     foreach (DictionaryEntry entry in themeDictionary)
     {
         if (entry.Value is SolidColorBrush brush)
         {
             object colorKey = ThemeResourceHelper.GetColorKey(brush);
             if (colorKey != null && colors.Contains(colorKey))
             {
                 brush.SetCurrentValue(SolidColorBrush.ColorProperty, (Color)colors[colorKey]);
             }
         }
     }
 }
Example #2
0
        public void UpdateBrushes(ResourceDictionary themeDictionary)
        {
            int count = 0;

            foreach (DictionaryEntry entry in themeDictionary)
            {
                if (entry.Value is SolidColorBrush brush)
                {
                    object colorKey = ThemeResourceHelper.GetColorKey(brush);
                    if (colorKey != null && _colors.Contains(colorKey))
                    {
                        brush.SetCurrentValue(SolidColorBrush.ColorProperty, (Color)_colors[colorKey]);
                        count++;
                    }
                }
            }

            Debug.WriteLine($"{count} brushes updated");
        }