Skip to content

Commit

Permalink
Use DialogTitleFontSize and DialogMessageFontSize via DynamicResource…
Browse files Browse the repository at this point in the history
… at the base MetroDialog style
  • Loading branch information
punker76 committed Jan 14, 2018
1 parent be61e1b commit e54aaaf
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ private void Initialize([CanBeNull] MetroWindow owningWindow, [CanBeNull] MetroD
this.Resources.MergedDictionaries.Add(this.DialogSettings.CustomResourceDictionary);
}

this.DialogTitleFontSize = (this.TryFindResource("DialogTitleFontSize") as double?).GetValueOrDefault(this.DialogTitleFontSize);
this.DialogMessageFontSize = (this.TryFindResource("DialogMessageFontSize") as double?).GetValueOrDefault(this.DialogMessageFontSize);

this.HandleThemeChange();

this.Loaded += this.BaseMetroDialogLoaded;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected override void OnLoaded()
switch (this.DialogSettings.ColorScheme)
{
case MetroDialogColorScheme.Accented:
this.PART_NegativeButton.Style = this.FindResource("AccentedDialogHighlightedSquareButton") as Style;
this.PART_NegativeButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
this.PART_TextBox.SetResourceReference(ForegroundProperty, "BlackColorBrush");
this.PART_TextBox.SetResourceReference(ControlsHelper.FocusBorderBrushProperty, "TextBoxFocusBorderBrush");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ protected override void OnLoaded()
switch (this.DialogSettings.ColorScheme)
{
case MetroDialogColorScheme.Accented:
this.PART_NegativeButton.Style = this.FindResource("AccentedDialogHighlightedSquareButton") as Style;
this.PART_NegativeButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
this.PART_TextBox.SetResourceReference(ForegroundProperty, "BlackColorBrush");
this.PART_TextBox2.SetResourceReference(ForegroundProperty, "BlackColorBrush");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ private static void SetButtonState(MessageDialog md)
switch (md.DialogSettings.ColorScheme)
{
case MetroDialogColorScheme.Accented:
md.PART_AffirmativeButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
md.PART_NegativeButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
md.PART_FirstAuxiliaryButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
md.PART_SecondAuxiliaryButton.Style = md.FindResource("AccentedDialogHighlightedSquareButton") as Style;
md.PART_AffirmativeButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
md.PART_NegativeButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
md.PART_FirstAuxiliaryButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
md.PART_SecondAuxiliaryButton.SetResourceReference(StyleProperty, "AccentedDialogHighlightedSquareButton");
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
<Setter Property="controls:ControlsHelper.ContentCharacterCasing" Value="Normal" />
</Style>
</Style.Resources>
<Setter Property="DialogTitleFontSize" Value="{DynamicResource DialogTitleFontSize}" />
<Setter Property="DialogMessageFontSize" Value="{DynamicResource DialogMessageFontSize}" />
<Setter Property="Background" Value="{DynamicResource WhiteColorBrush}" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}" />
Expand Down

0 comments on commit e54aaaf

Please sign in to comment.