Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

Control.FontFamily Property

Gets or sets the name of the specified font.

Namespace: System.Windows.Controls
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:  http://schemas.microsoft.com/winfx/2006/xaml/presentation

[BindableAttribute(true)] 
[LocalizabilityAttribute(LocalizationCategory.Font)] 
public FontFamily FontFamily { get; set; }
/** @property */
public FontFamily get_FontFamily ()

/** @property */
public void set_FontFamily (FontFamily value)

public function get FontFamily () : FontFamily

public function set FontFamily (value : FontFamily)

<object>
  <object.FontFamily>
    <FontFamily .../>
  </object.FontFamily>
</object>
<object FontFamily="FontFamily" .../>

Property Value

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

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.";

    }
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.