private void SetTheme() { Grid1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(AppTheme.Background))); stp1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(Grid1.Background.ToString()))); ThemeSettings_Tb.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(Grid1.Background.ToString()))); ThemeSettings_Tb.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(AppTheme.Foreground))); Save_Button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Background)); Save_Button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); //Irritate through the the parent Holder and set the proper theme to the children foreach (object obj1 in Grid2.Children) { if (obj1 is StackPanel) { foreach (object obj2 in (obj1 as StackPanel).Children) { if (obj2 is TextBox) { (obj2 as TextBox).Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(stp1.Background.ToString()))); (obj2 as TextBox).Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); } else if (obj2 is Button) { (obj2 as Button).Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Background)); (obj2 as Button).Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); } } } if (obj1 is TextBlock) { (obj1 as TextBlock).Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); } } }
private void SetColor(PowerItem item) { string color = AppTheme.GetAnotherColor(AppTheme.Background); item.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(color))); }
private void SetTheme() { Grid1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(AppTheme.Background))); stp1.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(Grid1.Background.ToString()))); ThemeSettings_Tb.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(Grid1.Background.ToString()))); ThemeSettings_Tb.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(AppTheme.Foreground))); Save_Button.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Background)); Save_Button.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); foreach (object obj1 in Grid2.Children) { if (obj1 is StackPanel) { foreach (object obj2 in (obj1 as StackPanel).Children) { if (obj2 is TextBox) { (obj2 as TextBox).Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(stp1.Background.ToString()))); (obj2 as TextBox).Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); } } } if (obj1 is TextBlock) { (obj1 as TextBlock).Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.Foreground)); } } }
public PowerItem() { string color = AppTheme.GetAnotherColor(AppTheme.Background); Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(AppTheme.GetAnotherColor(color))); MouseLeftButtonDown += PowerItem_MouseLeftButtonDown; MouseEnter += PowerItem_MouseEnter; MouseLeave += PowerItem_MouseLeave; }