Skip to content

Commit

Permalink
(GH-3753) Use HeaderedControlHelper.HeaderFontFamily attached property
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Feb 29, 2020
1 parent 178a288 commit bd82726
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
19 changes: 0 additions & 19 deletions src/MahApps.Metro/Controls/ToggleSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,6 @@ public class ToggleSwitch : HeaderedContentControl

private Thumb SwitchThumb { get; set; }

/// <summary>Identifies the <see cref="HeaderFontFamily"/> dependency property.</summary>
public static readonly DependencyProperty HeaderFontFamilyProperty
= DependencyProperty.Register(nameof(HeaderFontFamily),
typeof(FontFamily),
typeof(ToggleSwitch),
new PropertyMetadata(SystemFonts.MessageFontFamily));

/// <summary>
/// Gets or set the font family of the header content presenter.
/// </summary>
[Bindable(true)]
[Localizability(LocalizationCategory.Font)]
[Category(AppName.MahApps)]
public FontFamily HeaderFontFamily
{
get => (FontFamily)this.GetValue(HeaderFontFamilyProperty);
set => this.SetValue(HeaderFontFamilyProperty, value);
}

/// <summary>Identifies the <see cref="ContentDirection"/> dependency property.</summary>
public static readonly DependencyProperty ContentDirectionProperty
= DependencyProperty.Register(nameof(ContentDirection),
Expand Down
5 changes: 3 additions & 2 deletions src/MahApps.Metro/Themes/ToggleSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Setter Property="FontFamily" Value="{DynamicResource MahApps.Fonts.Family.ToggleSwitch}" />
<Setter Property="FontSize" Value="{DynamicResource MahApps.Font.Size.ToggleSwitch}" />
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ToggleSwitch.ContentForeground}" />
<Setter Property="HeaderFontFamily" Value="{DynamicResource MahApps.Fonts.Family.ToggleSwitch.Header}" />
<Setter Property="mah:HeaderedControlHelper.HeaderFontFamily" Value="{DynamicResource MahApps.Fonts.Family.ToggleSwitch.Header}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="SnapsToDevicePixels" Value="True" />
Expand All @@ -47,9 +47,10 @@
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
IsHitTestVisible="False"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
TextElement.FontFamily="{TemplateBinding HeaderFontFamily}"
TextElement.FontFamily="{TemplateBinding mah:HeaderedControlHelper.HeaderFontFamily}"
TextElement.FontSize="{TemplateBinding mah:HeaderedControlHelper.HeaderFontSize}"
TextElement.FontWeight="{TemplateBinding mah:HeaderedControlHelper.HeaderFontWeight}"
TextElement.FontStretch="{TemplateBinding mah:HeaderedControlHelper.HeaderFontStretch}"
TextElement.Foreground="{DynamicResource MahApps.Brushes.ToggleSwitch.HeaderForeground}"
Visibility="Collapsed" />

Expand Down

0 comments on commit bd82726

Please sign in to comment.