SystemFonts Class
Contains properties that expose the system resources that concern fonts.
Assembly: PresentationFramework (in PresentationFramework.dll)
The SystemFonts type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | CaptionFontFamily | Gets the metric that determines the font family of the caption of the nonclient area of a nonminimized window. |
![]() ![]() | CaptionFontFamilyKey | Gets the ResourceKey for the CaptionFontFamily property. |
![]() ![]() | CaptionFontSize | Gets the metric that determines the caption font-size for the nonclient area of a nonminimized window. |
![]() ![]() | CaptionFontSizeKey | Gets the ResourceKey for the CaptionFontSize property. |
![]() ![]() | CaptionFontStyle | Gets the metric that determines the caption font-style for the nonclient area of a nonminimized window. |
![]() ![]() | CaptionFontStyleKey | Gets the ResourceKey for the CaptionFontStyle property. |
![]() ![]() | CaptionFontTextDecorations | Gets the metric that determines the caption text-decorations for the nonclient area of a nonminimized window. |
![]() ![]() | CaptionFontTextDecorationsKey | Gets the ResourceKey for the CaptionFontTextDecorations property. |
![]() ![]() | CaptionFontWeight | Gets the metric that determines the caption font-weight for the nonclient area of a nonminimized window. |
![]() ![]() | CaptionFontWeightKey | Gets the ResourceKey for the CaptionFontWeight property. |
![]() ![]() | IconFontFamily | Gets the font family from the logical font information for the current icon-title font. |
![]() ![]() | IconFontFamilyKey | Gets the ResourceKey for the IconFontFamily property. |
![]() ![]() | IconFontSize | Gets the font size from the logical font information for the current icon-title font. |
![]() ![]() | IconFontSizeKey | Gets the ResourceKey for the IconFontSize property. |
![]() ![]() | IconFontStyle | Gets the font style from the logical font information for the current icon-title font. |
![]() ![]() | IconFontStyleKey | Gets the ResourceKey for the IconFontStyle property. |
![]() ![]() | IconFontTextDecorations | Gets the text decorations from the logical font information for the current icon-title font. |
![]() ![]() | IconFontTextDecorationsKey | Gets the ResourceKey for the IconFontTextDecorations property. |
![]() ![]() | IconFontWeight | Gets the font weight from the logical font information for the current icon-title font. |
![]() ![]() | IconFontWeightKey | Gets the ResourceKey for the IconFontWeight property. |
![]() ![]() | MenuFontFamily | Gets the metric that determines the font family for menu text. |
![]() ![]() | MenuFontFamilyKey | Gets the ResourceKey for the MenuFontFamily property. |
![]() ![]() | MenuFontSize | Gets the metric that determines the font size of menu text. |
![]() ![]() | MenuFontSizeKey | Gets the ResourceKey for the MenuFontSize property. |
![]() ![]() | MenuFontStyle | Gets the metric that determines the font style for menu text. |
![]() ![]() | MenuFontStyleKey | Gets the ResourceKey for the MenuFontStyle property. |
![]() ![]() | MenuFontTextDecorations | Gets the metric that determines the text decorations for menu text. |
![]() ![]() | MenuFontTextDecorationsKey | Gets the ResourceKey for the MenuFontTextDecorations property. |
![]() ![]() | MenuFontWeight | Gets the metric that determines the font weight for menu text. |
![]() ![]() | MenuFontWeightKey | Gets the ResourceKey for the MenuFontWeight property. |
![]() ![]() | MessageFontFamily | Gets the metric that determines the font family for message box text. |
![]() ![]() | MessageFontFamilyKey | Gets the ResourceKey for the MessageFontFamily property. |
![]() ![]() | MessageFontSize | Gets the metric that determines the font size of message box text. |
![]() ![]() | MessageFontSizeKey | Gets the ResourceKey for the MessageFontSize property. |
![]() ![]() | MessageFontStyle | Gets the metric that determines the font style for message box text. |
![]() ![]() | MessageFontStyleKey | Gets the ResourceKey for the MessageFontStyle property. |
![]() ![]() | MessageFontTextDecorations | Gets the metric that determines the decorations for message box text. |
![]() ![]() | MessageFontTextDecorationsKey | Gets the ResourceKey for the MessageFontTextDecorations property. |
![]() ![]() | MessageFontWeight | Gets the metric that determines the font weight for message box text. |
![]() ![]() | MessageFontWeightKey | Gets the ResourceKey for the MessageFontWeight property. |
![]() ![]() | SmallCaptionFontFamily | Gets the metric that determines the font family of the small-caption text for the nonclient area of a nonminimized window. |
![]() ![]() | SmallCaptionFontFamilyKey | Gets the ResourceKey for the SmallCaptionFontFamily property. |
![]() ![]() | SmallCaptionFontSize | Gets the metric that determines the font size of the small-caption text for the nonclient area of a nonminimized window. |
![]() ![]() | SmallCaptionFontSizeKey | Gets the ResourceKey for the SmallCaptionFontSize property. |
![]() ![]() | SmallCaptionFontStyle | Gets the metric that determines the font style of the small-caption text for the nonclient area of a nonminimized window. |
![]() ![]() | SmallCaptionFontStyleKey | Gets the ResourceKey for the SmallCaptionFontStyle property. |
![]() ![]() | SmallCaptionFontTextDecorations | Gets the metric that determines the decorations of the small-caption text for the nonclient area of a nonminimized window. |
![]() ![]() | SmallCaptionFontTextDecorationsKey | Gets the ResourceKey for the SmallCaptionFontTextDecorations property. |
![]() ![]() | SmallCaptionFontWeight | Gets the metric that determines the font weight of the small-caption text for the nonclient area of a nonminimized window. |
![]() ![]() | SmallCaptionFontWeightKey | Gets the ResourceKey for the SmallCaptionFontWeight property. |
![]() ![]() | StatusFontFamily | Gets the metric that determines the font family of the text used in status bars and ToolTips for the nonclient area of a nonminimized window. |
![]() ![]() | StatusFontFamilyKey | Gets the ResourceKey for the StatusFontFamily property. |
![]() ![]() | StatusFontSize | Gets the metric that determines the font size of the text used in status bars and ToolTips for the nonclient area of a nonminimized window. |
![]() ![]() | StatusFontSizeKey | Gets the ResourceKey for the StatusFontSize property. |
![]() ![]() | StatusFontStyle | Gets the metric that determines the font style of the text used in status bars and ToolTips for the nonclient area of a nonminimized window. |
![]() ![]() | StatusFontStyleKey | Gets the ResourceKey for the StatusFontStyle property. |
![]() ![]() | StatusFontTextDecorations | Gets the metric that determines the decorations of the text used in status bars and ToolTips for the nonclient area of a nonminimized window. |
![]() ![]() | StatusFontTextDecorationsKey | Gets the ResourceKey for the StatusFontTextDecorations property. |
![]() ![]() | StatusFontWeight | Gets the metric that determines the font weight of the text used in status bars and ToolTips for the nonclient area of a nonminimized window. |
![]() ![]() | StatusFontWeightKey | Gets the ResourceKey for the StatusFontWeight property. |
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.
![]() |
---|
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
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.