diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Control.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Control.cs index 401cd0bc4dd..addb6ada908 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Control.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Control.cs @@ -192,7 +192,7 @@ public FontFamily FontFamily public static readonly DependencyProperty FontSizeProperty = TextElement.FontSizeProperty.AddOwner( typeof(Control), - new FrameworkPropertyMetadata(SystemFonts.MessageFontSize, + new FrameworkPropertyMetadata(SystemFonts.ThemeMessageFontSize, FrameworkPropertyMetadataOptions.Inherits)); /// diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridTextColumn.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridTextColumn.cs index 9c383fdf40e..ae2bae55c24 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridTextColumn.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGridTextColumn.cs @@ -320,7 +320,7 @@ public FontFamily FontFamily public static readonly DependencyProperty FontSizeProperty = TextElement.FontSizeProperty.AddOwner( typeof(DataGridTextColumn), - new FrameworkPropertyMetadata(SystemFonts.MessageFontSize, FrameworkPropertyMetadataOptions.Inherits, DataGridColumn.NotifyPropertyChangeForRefreshContent)); + new FrameworkPropertyMetadata(SystemFonts.ThemeMessageFontSize, FrameworkPropertyMetadataOptions.Inherits, DataGridColumn.NotifyPropertyChangeForRefreshContent)); /// /// The size of the desired font. diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/MenuItem.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/MenuItem.cs index ef3905f69e8..7c08c1c6009 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/MenuItem.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/MenuItem.cs @@ -174,7 +174,7 @@ static MenuItem() ForegroundProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemColors.MenuTextBrush)); FontFamilyProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemFonts.MessageFontFamily)); - FontSizeProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemFonts.MessageFontSize)); + FontSizeProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemFonts.ThemeMessageFontSize)); FontStyleProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemFonts.MessageFontStyle)); FontWeightProperty.OverrideMetadata(typeof(MenuItem), new FrameworkPropertyMetadata(SystemFonts.MessageFontWeight)); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextElement.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextElement.cs index b97dd1fc326..fb4171eea01 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextElement.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Documents/TextElement.cs @@ -647,7 +647,7 @@ public static FontStretch GetFontStretch(DependencyObject element) typeof(double), typeof(TextElement), new FrameworkPropertyMetadata( - SystemFonts.MessageFontSize, + SystemFonts.ThemeMessageFontSize, FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits), new ValidateValueCallback(IsValidFontSize)); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/FrameworkElement.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/FrameworkElement.cs index b5157daf65e..d29ba997760 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/FrameworkElement.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/FrameworkElement.cs @@ -2411,7 +2411,7 @@ static FrameworkElement() // Coerce Callback for font properties for responding to system themes TextElement.FontFamilyProperty.OverrideMetadata(_typeofThis, new FrameworkPropertyMetadata(SystemFonts.MessageFontFamily, FrameworkPropertyMetadataOptions.Inherits, null, new CoerceValueCallback(CoerceFontFamily))); - TextElement.FontSizeProperty.OverrideMetadata(_typeofThis, new FrameworkPropertyMetadata(SystemFonts.MessageFontSize, FrameworkPropertyMetadataOptions.Inherits, null, new CoerceValueCallback(CoerceFontSize))); + TextElement.FontSizeProperty.OverrideMetadata(_typeofThis, new FrameworkPropertyMetadata(SystemFonts.ThemeMessageFontSize, FrameworkPropertyMetadataOptions.Inherits, null, new CoerceValueCallback(CoerceFontSize))); TextElement.FontStyleProperty.OverrideMetadata(_typeofThis, new FrameworkPropertyMetadata(SystemFonts.MessageFontStyle, FrameworkPropertyMetadataOptions.Inherits, null, new CoerceValueCallback(CoerceFontStyle))); TextElement.FontWeightProperty.OverrideMetadata(_typeofThis, new FrameworkPropertyMetadata(SystemFonts.MessageFontWeight, FrameworkPropertyMetadataOptions.Inherits, null, new CoerceValueCallback(CoerceFontWeight))); @@ -5564,7 +5564,7 @@ private static object CoerceFontSize(DependencyObject o, object value) // For root elements with default values, return current system metric if local value has not been set if (ShouldUseSystemFont((FrameworkElement)o, TextElement.FontSizeProperty)) { - return SystemFonts.MessageFontSize; + return SystemFonts.ThemeMessageFontSize; } return value; diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemFonts.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemFonts.cs index 64d5aa50f86..2034e9141a3 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemFonts.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/SystemFonts.cs @@ -422,15 +422,25 @@ public static TextDecorationCollection StatusFontTextDecorations /// Maps to SPI_NONCLIENTMETRICS /// public static double MessageFontSize + { + get + { + return ConvertFontHeight(SystemParameters.NonClientMetrics.lfMessageFont.lfHeight); + } + } + + internal static double ThemeMessageFontSize { get { // TODO : Find a better solution to this. Difference in default size of font in Fluent and other themes. - if(ThemeManager.IsFluentThemeEnabled) + if(ThemeManager.IsFluentThemeEnabled + || ThemeManager.IsFluentThemeDictionaryIncluded()) { - return ThemeManager.DefaultFluentThemeFontSize; + return MessageFontSize * ThemeManager.DefaultFluentFontSizeFactor ; } - return ConvertFontHeight(SystemParameters.NonClientMetrics.lfMessageFont.lfHeight); + + return MessageFontSize; } } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeManager.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeManager.cs index 1755cdda247..cf2af8ff911 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeManager.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/ThemeManager.cs @@ -204,6 +204,11 @@ internal static ResourceDictionary GetThemeDictionary(ThemeMode themeMode) return rd; } + internal static bool IsFluentThemeDictionaryIncluded() + { + return Application.Current != null && LastIndexOfFluentThemeDictionary(Application.Current.Resources) != -1; + } + #endregion @@ -323,7 +328,7 @@ internal static bool IsFluentThemeEnabled internal static bool IgnoreWindowResourcesChange { get; set; } = false; - internal static double DefaultFluentThemeFontSize => 14; + internal const double DefaultFluentFontSizeFactor = 14.0 / 12.0 ; internal static WindowCollection FluentEnabledWindows { get; set; } = new WindowCollection(); diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Button.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Button.xaml index 0aaffac1477..f8514d640ac 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Button.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Button.xaml @@ -26,7 +26,6 @@ - @@ -86,7 +85,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/CheckBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/CheckBox.xaml index 188f2a03e88..b553c0bfa91 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/CheckBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/CheckBox.xaml @@ -39,7 +39,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ComboBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ComboBox.xaml index 0132443aaf4..494cbeff069 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ComboBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ComboBox.xaml @@ -152,7 +152,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DataGrid.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DataGrid.xaml index 4b9bcb301b8..67bbf76572f 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DataGrid.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DataGrid.xaml @@ -524,7 +524,6 @@ - @@ -666,7 +665,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DatePicker.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DatePicker.xaml index a42c4355b5c..62453c2a2f0 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DatePicker.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/DatePicker.xaml @@ -83,7 +83,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Expander.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Expander.xaml index 4007ebd3ffd..1efa22bd69c 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Expander.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/Expander.xaml @@ -275,7 +275,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ListBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ListBox.xaml index ec6fc0d18f9..91e3f20fdb5 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ListBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ListBox.xaml @@ -15,7 +15,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml index ff33dfb3321..74a2bf32b9a 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/PasswordBox.xaml @@ -36,7 +36,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RadioButton.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RadioButton.xaml index 289b4e184e6..19f215b531b 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RadioButton.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RadioButton.xaml @@ -35,7 +35,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RepeatButton.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RepeatButton.xaml index 58a2ad7b3e1..f3aa0defe6a 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RepeatButton.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RepeatButton.xaml @@ -23,7 +23,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml index 21641bd4f92..5d9ef3cccf9 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/RichTextBox.xaml @@ -24,7 +24,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml index 93465ea7adb..5df89ec4eca 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TextBox.xaml @@ -32,7 +32,6 @@ - @@ -246,7 +245,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ToggleButton.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ToggleButton.xaml index 11069b84c15..591991e2bec 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ToggleButton.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/ToggleButton.xaml @@ -27,7 +27,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TreeViewItem.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TreeViewItem.xaml index 23f71206d43..b3412ead39c 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TreeViewItem.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Styles/TreeViewItem.xaml @@ -81,7 +81,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml index ee82e36a4c2..35c459083e2 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Dark.xaml @@ -710,7 +710,6 @@ - @@ -753,7 +752,6 @@ - @@ -1124,7 +1122,6 @@ - @@ -1367,7 +1364,6 @@ - @@ -1926,7 +1922,6 @@ - @@ -2021,7 +2016,6 @@ - @@ -2180,7 +2174,6 @@ - @@ -2403,7 +2396,6 @@ - @@ -2647,7 +2639,6 @@ - @@ -3138,7 +3129,6 @@ - @@ -3282,7 +3272,6 @@ - @@ -3437,7 +3426,6 @@ - @@ -3482,7 +3470,6 @@ - @@ -4172,7 +4159,6 @@ - @@ -4304,7 +4290,6 @@ - @@ -4339,7 +4324,6 @@ - @@ -4703,7 +4687,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml index 25778c5e837..04d5ef69886 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.HC.xaml @@ -688,7 +688,6 @@ - @@ -731,7 +730,6 @@ - @@ -1102,7 +1100,6 @@ - @@ -1345,7 +1342,6 @@ - @@ -1904,7 +1900,6 @@ - @@ -1999,7 +1994,6 @@ - @@ -2158,7 +2152,6 @@ - @@ -2381,7 +2374,6 @@ - @@ -2625,7 +2617,6 @@ - @@ -3116,7 +3107,6 @@ - @@ -3260,7 +3250,6 @@ - @@ -3415,7 +3404,6 @@ - @@ -3460,7 +3448,6 @@ - @@ -4150,7 +4137,6 @@ - @@ -4282,7 +4268,6 @@ - @@ -4317,7 +4302,6 @@ - @@ -4681,7 +4665,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml index 869a0347ec0..86f83cf4e2c 100644 --- a/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml +++ b/src/Microsoft.DotNet.Wpf/src/Themes/PresentationFramework.Fluent/Themes/Fluent.Light.xaml @@ -708,7 +708,6 @@ - @@ -751,7 +750,6 @@ - @@ -1122,7 +1120,6 @@ - @@ -1365,7 +1362,6 @@ - @@ -1924,7 +1920,6 @@ - @@ -2019,7 +2014,6 @@ - @@ -2178,7 +2172,6 @@ - @@ -2401,7 +2394,6 @@ - @@ -2645,7 +2637,6 @@ - @@ -3136,7 +3127,6 @@ - @@ -3280,7 +3270,6 @@ - @@ -3435,7 +3424,6 @@ - @@ -3480,7 +3468,6 @@ - @@ -4170,7 +4157,6 @@ - @@ -4302,7 +4288,6 @@ - @@ -4337,7 +4322,6 @@ - @@ -4701,7 +4685,6 @@ -