private static void Update(DependencyObject dependencyObject, ThemeColorType color) { try { if (color != ThemeColorType.BoundColor) { GetColorProeprty(dependencyObject); Binding binding = new Binding(color.ToString() + "Color") { Source = PaletteInstance }; BindingOperations.SetBinding(dependencyObject, SolidColorBrush.ColorProperty, binding); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }