Skip to content

Commit

Permalink
Updates MA.M font namespaces to be more uniform
Browse files Browse the repository at this point in the history
- MA.M font namespacing was inconsistent between sizes and families
- This commit places "MahApps.Fonts" first, followed by "Size" or "Family"
- Further granularity is applied for specificity (e.g. "Content", "Header")
- Items previously named "Default" are now "Base"
- "Default" is added to the end of all items except Win10 ToggleSwitches to allow for future styles
- Items such as "DialogTitle" and "FlyoutHeader" are separated (e.g. "Dialog.Title", "Flyout.Header")

- Resolves MahApps#3584
  • Loading branch information
amkuchta committed Oct 14, 2019
1 parent d614193 commit fc37122
Show file tree
Hide file tree
Showing 36 changed files with 122 additions and 121 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
<TextBlock Grid.Column="1"
Margin="10"
VerticalAlignment="Center"
FontSize="{DynamicResource MahApps.Sizes.Font.Normal}"
FontSize="{DynamicResource MahApps.Fonts.Size.Base.Default}"
Text="{Binding ElementName=BrushResource, Path=(Shape.Fill)}" />
<TextBlock Grid.Column="2"
Margin="10"
VerticalAlignment="Center"
FontSize="{DynamicResource MahApps.Sizes.Font.Normal}"
FontSize="{DynamicResource MahApps.Fonts.Size.Base.Default}"
Text="{Binding}" />
</Grid>
</DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<TextBlock Margin="0 -1 8 0"
VerticalAlignment="Center"
FontFamily="{DynamicResource MahApps.Fonts.Header}"
FontSize="{DynamicResource MahApps.Sizes.Font.WindowTitle}"
FontFamily="{DynamicResource MahApps.Fonts.Family.Header.Default}"
FontSize="{DynamicResource MahApps.Fonts.Size.WindowTitle.Default}"
Text="{TemplateBinding Content}"
TextTrimming="CharacterEllipsis" />
<Button Margin="1 0 1 1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@
<TextBlock Grid.Row="0"
Margin="0 15 0 5"
Padding="0"
FontFamily="{DynamicResource MahApps.Fonts.Header}"
FontSize="{DynamicResource MahApps.Sizes.Font.Header}"
FontFamily="{DynamicResource MahApps.Fonts.Family.Header.Default}"
FontSize="{DynamicResource MahApps.Fonts.Size.Header.Default}"
Text="{Binding Label}" />
<ScrollViewer Grid.Row="1"
Focusable="False"
Expand Down
6 changes: 3 additions & 3 deletions src/MahApps.Metro/Controls/Dialogs/LoginDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Controls:TextBoxHelper.Watermark="{Binding UsernameWatermark, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
Controls:VisibilityHelper.IsCollapsed="{Binding ShouldHideUsername, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
CharacterCasing="{Binding UsernameCharacterCasing, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
FontSize="{DynamicResource MahApps.Sizes.Font.DialogMessage}"
FontSize="{DynamicResource MahApps.Fonts.Size.Dialog.Message.Default}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
Text="{Binding Username, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap" />
Expand All @@ -35,13 +35,13 @@
Behaviors:PasswordBoxBindingBehavior.Password="{Binding Password, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
Controls:TextBoxHelper.SelectAllOnFocus="True"
Controls:TextBoxHelper.Watermark="{Binding PasswordWatermark, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
FontSize="{DynamicResource MahApps.Sizes.Font.DialogMessage}"
FontSize="{DynamicResource MahApps.Fonts.Size.Dialog.Message.Default}"
Foreground="{Binding Foreground, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}" />
<CheckBox x:Name="PART_RememberCheckBox"
Grid.Row="3"
Margin="0 5 0 0"
Content="{Binding RememberCheckBoxText, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
FontSize="{DynamicResource MahApps.Sizes.Font.DialogMessage}"
FontSize="{DynamicResource MahApps.Fonts.Size.Dialog.Message.Default}"
IsChecked="{Binding RememberCheckBoxChecked, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding RememberCheckBoxVisibility, RelativeSource={RelativeSource AncestorType=Dialogs:LoginDialog, Mode=FindAncestor}, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Grid.Row="4"
Expand Down
16 changes: 8 additions & 8 deletions src/MahApps.Metro/Styles/Controls.Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.FlatButton.Background}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource MahApps.Styles.Button.FocusVisualStyle.Flat}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.FlatButton}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.FlatButton.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.FlatButton.Foreground}" />
<Setter Property="Padding" Value="10 5 10 5" />
<Setter Property="SnapsToDevicePixels" Value="True" />
Expand Down Expand Up @@ -72,7 +72,7 @@
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.FlatButton.Background}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FocusVisualStyle" Value="{DynamicResource MahApps.Styles.Button.FocusVisualStyle.Flat}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.FlatButton}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.FlatButton.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.FlatButton.Foreground}" />
<Setter Property="Padding" Value="10 5 10 5" />
<Setter Property="SnapsToDevicePixels" Value="True" />
Expand Down Expand Up @@ -399,8 +399,8 @@
<Setter Property="Controls:ControlsHelper.CornerRadius" Value="3" />
<Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource MahApps.Brushes.Button.MouseOverBorder}" />
<Setter Property="Controls:ControlsHelper.FocusBorderThickness" Value="2" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.UpperCaseContent}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Base.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.UpperCaseContent.Default}" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="MinHeight" Value="25" />
Expand Down Expand Up @@ -461,7 +461,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Lower" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Default}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Base.Default}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="MinHeight" Value="25" />
Expand Down Expand Up @@ -700,8 +700,8 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Controls:ControlsHelper.CornerRadius" Value="3" />
<Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource MahApps.Brushes.Button.MouseOverBorder}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.UpperCaseContent}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Base.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.UpperCaseContent.Default}" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="MinHeight" Value="25" />
Expand Down Expand Up @@ -783,7 +783,7 @@
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Default}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Base.Default}" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="HorizontalAlignment" Value="Left" />
Expand Down
4 changes: 2 additions & 2 deletions src/MahApps.Metro/Styles/Controls.Calendar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,8 @@
<Style x:Key="MahApps.Styles.Calendar"
BasedOn="{StaticResource MahApps.Styles.Calendar.Base}"
TargetType="{x:Type Calendar}">
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
</Style>

</ResourceDictionary>
4 changes: 2 additions & 2 deletions src/MahApps.Metro/Styles/Controls.CheckBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource MahApps.Brushes.Highlight}" />
<Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource MahApps.Brushes.CheckBox.MouseOver}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Label.Text}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="Padding" Value="6 0 0 0" />
Expand Down
6 changes: 3 additions & 3 deletions src/MahApps.Metro/Styles/Controls.ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@
<Setter Property="BorderThickness" Value="{DynamicResource ComboBoxBorderThemeThickness}" />
<Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource MahApps.Brushes.ComboBox.MouseOverInnerBorder}" />
<Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource MahApps.Brushes.TextBox.MouseOverBorder}" />
<Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource MahApps.Sizes.Font.ClearTextButton}" />
<Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource MahApps.Fonts.Size.ClearTextButton.Default}" />
<Setter Property="Controls:TextBoxHelper.ButtonWidth" Value="24" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="MinHeight" Value="26" />
Expand Down
4 changes: 2 additions & 2 deletions src/MahApps.Metro/Styles/Controls.ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<Style x:Key="MahApps.Styles.Menu" TargetType="{x:Type Menu}">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.Menu.Background}" />
<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Menu}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Menu.Default}" />
<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}" />
<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
Expand Down Expand Up @@ -65,7 +65,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.ContextMenu.Border}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.ContextMenu}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.ContextMenu.Default}" />
<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}" />
<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}" />
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" />
Expand Down
8 changes: 4 additions & 4 deletions src/MahApps.Metro/Styles/Controls.DatePicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource MahApps.Brushes.TextBox.MouseOverBorder}" />
<Setter Property="Controls:TextBoxHelper.ButtonWidth" Value="22" />
<Setter Property="Controls:TextBoxHelper.IsMonitoring" Value="True" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}" />
<Setter Property="IsTodayHighlighted" Value="True" />
<Setter Property="MinHeight" Value="26" />
Expand Down Expand Up @@ -189,8 +189,8 @@
<Setter Property="ContextMenu" Value="{DynamicResource MahApps.TextBox.ContextMenu}" />
<Setter Property="Controls:TextBoxHelper.IsMonitoring" Value="True" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}" />
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
Expand Down
2 changes: 1 addition & 1 deletion src/MahApps.Metro/Styles/Controls.Expander.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Upper" />
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Controls:ExpanderHelper.HeaderDownStyle" Value="{StaticResource MahApps.Styles.ToggleButton.ExpanderHeader.Down}" />
<Setter Property="Controls:ExpanderHelper.HeaderLeftStyle" Value="{StaticResource MahApps.Styles.ToggleButton.ExpanderHeader.Left}" />
<Setter Property="Controls:ExpanderHelper.HeaderRightStyle" Value="{StaticResource MahApps.Styles.ToggleButton.ExpanderHeader.Right}" />
Expand Down
2 changes: 1 addition & 1 deletion src/MahApps.Metro/Styles/Controls.GroupBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Controls:ControlsHelper.ContentCharacterCasing" Value="Upper" />
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="Controls:ControlsHelper.HeaderFontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Controls:HeaderedControlHelper.HeaderBackground" Value="{DynamicResource MahApps.Brushes.Accent}" />
<Setter Property="Controls:HeaderedControlHelper.HeaderForeground" Value="{x:Null}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
Expand Down
2 changes: 1 addition & 1 deletion src/MahApps.Metro/Styles/Controls.Page.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Style x:Key="MahApps.Styles.Page" TargetType="{x:Type Page}">
<Setter Property="Background" Value="{DynamicResource MahApps.Brushes.White}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Black}" />
<Setter Property="TextElement.FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="TextElement.FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
</Style>

</ResourceDictionary>
6 changes: 3 additions & 3 deletions src/MahApps.Metro/Styles/Controls.PasswordBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@
<Setter Property="Controls:ControlsHelper.FocusBorderBrush" Value="{DynamicResource MahApps.Brushes.TextBox.FocusBorder}" />
<Setter Property="Controls:ControlsHelper.MouseOverBorderBrush" Value="{DynamicResource MahApps.Brushes.TextBox.MouseOverBorder}" />
<Setter Property="Controls:PasswordBoxHelper.CapsLockIcon" Value="{StaticResource MahApps.Controls.Grid.DefaultCapsLockIcon}" />
<Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource MahApps.Sizes.Font.ClearTextButton}" />
<Setter Property="Controls:TextBoxHelper.ButtonFontSize" Value="{DynamicResource MahApps.Fonts.Size.ClearTextButton.Default}" />
<Setter Property="Controls:TextBoxHelper.ButtonWidth" Value="22" />
<Setter Property="Controls:TextBoxHelper.IsMonitoring" Value="True" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Content}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Sizes.Font.Content}" />
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.Content.Default}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Fonts.Size.Content.Default}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Text}" />
<Setter Property="MinHeight" Value="26" />
<Setter Property="Padding" Value="0" />
Expand Down
Loading

0 comments on commit fc37122

Please sign in to comment.