SystemFonts Class

Contains properties that expose the system resources that concern fonts.

System.Object
  System.Windows.SystemFonts

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

public static class SystemFonts

The SystemFonts type exposes the following members.

  NameDescription
Public propertyStatic memberCaptionFontFamilyGets the metric that determines the font family of the caption of the nonclient area of a nonminimized window.
Public propertyStatic memberCaptionFontFamilyKeyGets the ResourceKey for the CaptionFontFamily property.
Public propertyStatic memberCaptionFontSizeGets the metric that determines the caption font-size for the nonclient area of a nonminimized window.
Public propertyStatic memberCaptionFontSizeKeyGets the ResourceKey for the CaptionFontSize property.
Public propertyStatic memberCaptionFontStyleGets the metric that determines the caption font-style for the nonclient area of a nonminimized window.
Public propertyStatic memberCaptionFontStyleKeyGets the ResourceKey for the CaptionFontStyle property.
Public propertyStatic memberCaptionFontTextDecorationsGets the metric that determines the caption text-decorations for the nonclient area of a nonminimized window.
Public propertyStatic memberCaptionFontTextDecorationsKeyGets the ResourceKey for the CaptionFontTextDecorations property.
Public propertyStatic memberCaptionFontWeightGets the metric that determines the caption font-weight for the nonclient area of a nonminimized window.
Public propertyStatic memberCaptionFontWeightKeyGets the ResourceKey for the CaptionFontWeight property.
Public propertyStatic memberIconFontFamilyGets the font family from the logical font information for the current icon-title font.
Public propertyStatic memberIconFontFamilyKeyGets the ResourceKey for the IconFontFamily property.
Public propertyStatic memberIconFontSizeGets the font size from the logical font information for the current icon-title font.
Public propertyStatic memberIconFontSizeKeyGets the ResourceKey for the IconFontSize property.
Public propertyStatic memberIconFontStyleGets the font style from the logical font information for the current icon-title font.
Public propertyStatic memberIconFontStyleKeyGets the ResourceKey for the IconFontStyle property.
Public propertyStatic memberIconFontTextDecorationsGets the text decorations from the logical font information for the current icon-title font.
Public propertyStatic memberIconFontTextDecorationsKeyGets the ResourceKey for the IconFontTextDecorations property.
Public propertyStatic memberIconFontWeightGets the font weight from the logical font information for the current icon-title font.
Public propertyStatic memberIconFontWeightKeyGets the ResourceKey for the IconFontWeight property.
Public propertyStatic memberMenuFontFamilyGets the metric that determines the font family for menu text.
Public propertyStatic memberMenuFontFamilyKeyGets the ResourceKey for the MenuFontFamily property.
Public propertyStatic memberMenuFontSizeGets the metric that determines the font size of menu text.
Public propertyStatic memberMenuFontSizeKeyGets the ResourceKey for the MenuFontSize property.
Public propertyStatic memberMenuFontStyleGets the metric that determines the font style for menu text.
Public propertyStatic memberMenuFontStyleKeyGets the ResourceKey for the MenuFontStyle property.
Public propertyStatic memberMenuFontTextDecorationsGets the metric that determines the text decorations for menu text.
Public propertyStatic memberMenuFontTextDecorationsKeyGets the ResourceKey for the MenuFontTextDecorations property.
Public propertyStatic memberMenuFontWeightGets the metric that determines the font weight for menu text.
Public propertyStatic memberMenuFontWeightKeyGets the ResourceKey for the MenuFontWeight property.
Public propertyStatic memberMessageFontFamilyGets the metric that determines the font family for message box text.
Public propertyStatic memberMessageFontFamilyKeyGets the ResourceKey for the MessageFontFamily property.
Public propertyStatic memberMessageFontSizeGets the metric that determines the font size of message box text.
Public propertyStatic memberMessageFontSizeKeyGets the ResourceKey for the MessageFontSize property.
Public propertyStatic memberMessageFontStyleGets the metric that determines the font style for message box text.
Public propertyStatic memberMessageFontStyleKeyGets the ResourceKey for the MessageFontStyle property.
Public propertyStatic memberMessageFontTextDecorationsGets the metric that determines the decorations for message box text.
Public propertyStatic memberMessageFontTextDecorationsKeyGets the ResourceKey for the MessageFontTextDecorations property.
Public propertyStatic memberMessageFontWeightGets the metric that determines the font weight for message box text.
Public propertyStatic memberMessageFontWeightKeyGets the ResourceKey for the MessageFontWeight property.
Public propertyStatic memberSmallCaptionFontFamilyGets the metric that determines the font family of the small-caption text for the nonclient area of a nonminimized window.
Public propertyStatic memberSmallCaptionFontFamilyKeyGets the ResourceKey for the SmallCaptionFontFamily property.
Public propertyStatic memberSmallCaptionFontSizeGets the metric that determines the font size of the small-caption text for the nonclient area of a nonminimized window.
Public propertyStatic memberSmallCaptionFontSizeKeyGets the ResourceKey for the SmallCaptionFontSize property.
Public propertyStatic memberSmallCaptionFontStyleGets the metric that determines the font style of the small-caption text for the nonclient area of a nonminimized window.
Public propertyStatic memberSmallCaptionFontStyleKeyGets the ResourceKey for the SmallCaptionFontStyle property.
Public propertyStatic memberSmallCaptionFontTextDecorationsGets the metric that determines the decorations of the small-caption text for the nonclient area of a nonminimized window.
Public propertyStatic memberSmallCaptionFontTextDecorationsKeyGets the ResourceKey for the SmallCaptionFontTextDecorations property.
Public propertyStatic memberSmallCaptionFontWeightGets the metric that determines the font weight of the small-caption text for the nonclient area of a nonminimized window.
Public propertyStatic memberSmallCaptionFontWeightKeyGets the ResourceKey for the SmallCaptionFontWeight property.
Public propertyStatic memberStatusFontFamilyGets the metric that determines the font family of the text used in status bars and ToolTips for the nonclient area of a nonminimized window.
Public propertyStatic memberStatusFontFamilyKeyGets the ResourceKey for the StatusFontFamily property.
Public propertyStatic memberStatusFontSizeGets the metric that determines the font size of the text used in status bars and ToolTips for the nonclient area of a nonminimized window.
Public propertyStatic memberStatusFontSizeKeyGets the ResourceKey for the StatusFontSize property.
Public propertyStatic memberStatusFontStyleGets the metric that determines the font style of the text used in status bars and ToolTips for the nonclient area of a nonminimized window.
Public propertyStatic memberStatusFontStyleKeyGets the ResourceKey for the StatusFontStyle property.
Public propertyStatic memberStatusFontTextDecorationsGets the metric that determines the decorations of the text used in status bars and ToolTips for the nonclient area of a nonminimized window.
Public propertyStatic memberStatusFontTextDecorationsKeyGets the ResourceKey for the StatusFontTextDecorations property.
Public propertyStatic memberStatusFontWeightGets the metric that determines the font weight of the text used in status bars and ToolTips for the nonclient area of a nonminimized window.
Public propertyStatic memberStatusFontWeightKeyGets the ResourceKey for the StatusFontWeight property.
Top

This example shows how to use the static resources of the SystemFonts class in order to style or customize a button.

System resources expose several system-determined values as both resources and properties in order to help you create visuals that are consistent with system settings. SystemFonts is a class that contains both system font values as static properties, and properties that reference resource keys that can be used to access those values dynamically at run time. For example, CaptionFontFamily is a SystemFonts value, and CaptionFontFamilyKey is a corresponding resource key.

In XAML, you can use the members of SystemFonts as either static properties or dynamic resource references (with the static property value as the key). Use a dynamic resource reference if you want the font metric to automatically update while the application runs; otherwise, use a static value reference.

NoteNote

The resource keys have the suffix "Key" appended to the property name.

The following example shows how to access and use the properties of SystemFonts as static values in order to style or customize a button. This markup example assigns SystemFonts values to a button.

<Button Margin="10, 10, 5, 5" Grid.Column="0" Grid.Row="3"      
     FontSize="{x:Static SystemFonts.IconFontSize}"
     FontWeight="{x:Static SystemFonts.MessageFontWeight}"
     FontFamily="{x:Static SystemFonts.CaptionFontFamily}">
     SystemFonts
</Button>

To use the values of SystemFonts in code, you do not have to use either a static value or a dynamic resource reference. Instead, use the non-key properties of the SystemFonts class. Although the non-key properties are apparently defined as static properties, the run-time behavior of WPF as hosted by the system will reevaluate the properties in real time and will properly account for user-driven changes to system values. The following example shows how to specify the font settings of a button.

Button btncsharp = new Button();
btncsharp.Content = "SystemFonts";
btncsharp.Background = SystemColors.ControlDarkDarkBrush;
btncsharp.FontSize = SystemFonts.IconFontSize;
btncsharp.FontWeight = SystemFonts.MessageFontWeight;
btncsharp.FontFamily = SystemFonts.CaptionFontFamily;
cv1.Children.Add(btncsharp);

More Code

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft