Skip to main content
 

Gets or sets the font family of the control.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

Syntax
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory.Font)]
public FontFamily FontFamily { get; set; }
public:
[BindableAttribute(true)]
[LocalizabilityAttribute(LocalizationCategory::Font)]
property FontFamily^ FontFamily {
	FontFamily^ get();
	void set(FontFamily^ value);
}
[<BindableAttribute(true)>]
[<LocalizabilityAttribute(LocalizationCategory.Font)>]
member FontFamily : FontFamily with get, set
<BindableAttribute(True)>
<LocalizabilityAttribute(LocalizationCategory.Font)>
Public Property FontFamily As FontFamily

Property Value

Type:

A font family. The default is the system dialog font.

Remarks

This property only affects a control whose template uses the property as a parameter. On other controls, this property has no impact.

Dependency Property Information

Identifier field

FontFamilyProperty

Metadata properties set to true

, ,

Examples

The following example shows how to set the font family property of a control.

<Button Name="btn2" FontFamily="Arial" 
        Click="ChangeFontFamily">
  FontFamily
</Button>
void ChangeFontFamily(object sender, RoutedEventArgs e)
{

    ffamily = btn2.FontFamily;
    str = ffamily.ToString();
    if (str == ("Arial Black"))
    {
        btn2.FontFamily = new FontFamily("Arial");
        btn2.Content = "FontFamily";
    }
    else
    {
        btn2.FontFamily = new FontFamily("Arial Black");
        btn2.Content = "Control font family changes from Arial to Arial Black.";

    }
}
Private Sub ChangeFontFamily(ByVal Sender As Object, ByVal e As RoutedEventArgs)

    ffamily = btn2.FontFamily
    str = ffamily.ToString()
    If (str = ("Arial Black")) Then

        btn2.FontFamily = New FontFamily("Arial")
        btn2.Content = "FontFamily"

    Else

        btn2.FontFamily = New FontFamily("Arial Black")
        btn2.Content = "Control font family changes from Arial to Arial Black."

    End If
End Sub
Version Information
.NET Framework
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top