Skip to content

Commit

Permalink
Add new dialog brush keys
Browse files Browse the repository at this point in the history
- MahApps.Brushes.Dialog.Background
- MahApps.Brushes.Dialog.Foreground
- MahApps.Brushes.Dialog.Background.Accent
- MahApps.Brushes.Dialog.Foreground.Accent
- MahApps.Brushes.Dialog.Glow
  • Loading branch information
punker76 committed Jun 29, 2021
1 parent 734d689 commit 2bd9a37
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/MahApps.Metro/Controls/Dialogs/BaseMetroDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ internal void HandleThemeChange()
{
case MetroDialogColorScheme.Theme:
ThemeManager.Current.ChangeTheme(this, this.Resources, theme);
this.SetValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.ThemeBackground"));
this.SetValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.ThemeForeground"));
this.SetCurrentValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Background"));
this.SetCurrentValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Foreground"));
break;
case MetroDialogColorScheme.Inverted:
theme = ThemeManager.Current.GetInverseTheme(theme);
Expand All @@ -323,23 +323,23 @@ internal void HandleThemeChange()
}

ThemeManager.Current.ChangeTheme(this, this.Resources, theme);
this.SetValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.ThemeBackground"));
this.SetValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.ThemeForeground"));
this.SetCurrentValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Background"));
this.SetCurrentValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Foreground"));
break;
case MetroDialogColorScheme.Accented:
ThemeManager.Current.ChangeTheme(this, this.Resources, theme);
this.SetValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.Highlight"));
this.SetValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.IdealForeground"));
this.SetCurrentValue(BackgroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Background.Accent"));
this.SetCurrentValue(ForegroundProperty, TryGetResource(theme, "MahApps.Brushes.Dialog.Foreground.Accent"));
break;
}

if (this.ParentDialogWindow != null)
{
this.ParentDialogWindow.SetValue(BackgroundProperty, this.Background);
var glowBrush = TryGetResource(theme, "MahApps.Brushes.Accent");
this.ParentDialogWindow.SetCurrentValue(BackgroundProperty, this.Background);
var glowBrush = TryGetResource(theme, "MahApps.Brushes.Dialog.Glow");
if (glowBrush != null)
{
this.ParentDialogWindow.SetValue(MetroWindow.GlowBrushProperty, glowBrush);
this.ParentDialogWindow.SetCurrentValue(MetroWindow.GlowBrushProperty, glowBrush);
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/MahApps.Metro/Styles/Themes/Theme.Template.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@
<SolidColorBrush x:Key="MahApps.Brushes.Flyout.Background" Color="{StaticResource MahApps.Colors.Flyout}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Flyout.Foreground" Color="{StaticResource MahApps.Colors.ThemeForeground}" options:Freeze="True" />

<SolidColorBrush x:Key="MahApps.Brushes.Dialog.Background" Color="{StaticResource MahApps.Colors.ThemeBackground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Dialog.Foreground" Color="{StaticResource MahApps.Colors.ThemeForeground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Dialog.Background.Accent" Color="{StaticResource MahApps.Colors.Highlight}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Dialog.Foreground.Accent" Color="{StaticResource MahApps.Colors.IdealForeground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Dialog.Glow" Color="{StaticResource MahApps.Colors.Accent}" options:Freeze="True" />

<SolidColorBrush x:Key="MahApps.Brushes.Window.FlyoutOverlay" Opacity="0.5" Color="{StaticResource MahApps.Colors.ThemeForeground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Window.Background" Color="{StaticResource MahApps.Colors.ThemeBackground}" options:Freeze="True" />
<SolidColorBrush x:Key="MahApps.Brushes.Separator" Color="#FFC4C4C5" options:Freeze="True" />
Expand Down
4 changes: 2 additions & 2 deletions src/MahApps.Metro/Themes/Dialogs/BaseMetroDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@
</ControlTemplate>

<Style x:Key="MahApps.Styles.BaseMetroDialog" TargetType="{x:Type dialogs:BaseMetroDialog}">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.ThemeBackground}" />
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Dialog.Background}" />
<Setter Property="DialogButtonFontSize" Value="{DynamicResource MahApps.Font.Size.Dialog.Button}" />
<Setter Property="DialogMessageFontSize" Value="{DynamicResource MahApps.Font.Size.Dialog.Message}" />
<Setter Property="DialogTitleFontSize" Value="{DynamicResource MahApps.Font.Size.Dialog.Title}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ThemeForeground}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Dialog.Foreground}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="KeyboardNavigation.ControlTabNavigation" Value="Cycle" />
Expand Down

0 comments on commit 2bd9a37

Please sign in to comment.