--- title: "How to: Use SystemFonts" ms.date: "03/30/2017" dev_langs: - "csharp" - "vb" helpviewer_keywords: - "system fonts [WPF]" - "fonts [WPF], system fonts" - "classes [WPF], SystemFonts" ms.assetid: 3f46a4ec-2225-408a-8123-8838a8f7057a --- # How to: Use SystemFonts This example shows how to use the static resources of the class in order to style or customize a button. ## Example 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. 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, is a value, and is a corresponding resource key. In [!INCLUDE[TLA2#tla_xaml](../../../includes/tla2sharptla-xaml-md.md)], you can use the members of 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. > [!NOTE] > The resource keys have the suffix "Key" appended to the property name. The following example shows how to access and use the properties of as static values in order to style or customize a button. This markup example assigns values to a button. [!code-xaml[SystemRes_snip#FontStaticResources](~/samples/snippets/csharp/VS_Snippets_Wpf/SystemRes_snip/CSharp/Pane1.xaml#fontstaticresources)] To use the values of 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 class. Although the non-key properties are apparently defined as static properties, the run-time behavior of [!INCLUDE[TLA2#tla_winclient](../../../includes/tla2sharptla-winclient-md.md)] 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. [!code-csharp[SystemRes_snip#FontResourcesCode](~/samples/snippets/csharp/VS_Snippets_Wpf/SystemRes_snip/CSharp/Pane1.xaml.cs#fontresourcescode)] [!code-vb[SystemRes_snip#FontResourcesCode](~/samples/snippets/visualbasic/VS_Snippets_Wpf/SystemRes_snip/VisualBasic/Pane1.xaml.vb#fontresourcescode)] ## See also - - [Paint an Area with a System Brush](../graphics-multimedia/how-to-paint-an-area-with-a-system-brush.md) - [Use SystemParameters](how-to-use-systemparameters.md) - [Use System Fonts Keys](how-to-use-system-fonts-keys.md) - [How-to Topics](resources-how-to-topics.md) - [x:Static Markup Extension](/dotnet/desktop-wpf/xaml-services/xstatic-markup-extension) - [XAML Resources](/dotnet/desktop-wpf/fundamentals/xaml-resources-define) - [DynamicResource Markup Extension](dynamicresource-markup-extension.md)